Mercurial > hg > pyloader
changeset 50:12de7b1bf303
stub interpolation of wrapper options
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 08 Jun 2011 22:17:43 -0700 |
parents | 43cb882c3b72 |
children | d44f3e6dcffa |
files | pyloader/factory.py |
diffstat | 1 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pyloader/factory.py Wed Jun 08 21:58:18 2011 -0700 +++ b/pyloader/factory.py Wed Jun 08 22:17:43 2011 -0700 @@ -105,6 +105,7 @@ config = {} interpolated = set() seen = set() + object_string = '%(object)s' # create a hash of section names names = {} @@ -126,13 +127,28 @@ wrapper, _path = path.split(':', 1) # TODO: could interpolate wrapper if wrapper in names: + + # TODO: will be correct for + # [foo:bar:%(here)s/objects.py:MyClass] + # but not for + # [foo:bar:fleem] + # in the latter case, just use fleem + wrapped_name = section + if wrapper not in config: wrapper_section = names[wrapper] if wrapper_section in seen: pass # TODO create_section(wrapper_section, iniconfig[wrapper_section]) - wrapper_options = config[wrapper] + wrapper_options = config[wrapper].copy() + # TODO interpolate wrapper_options + if 'args' in wrapper_options: + args = wrapper_options['args'][:] + wrapper_options['args'] = args + if 'kwargs' in wrapper_options: + kwargs = wrapper_options['kwargs'].copy() + wrapper_options['kwargs'] = kwargs path = _path # make a dict for the section