# HG changeset patch # User Jeff Hammel # Date 1307668878 25200 # Node ID 1f76705df520db75908785b3eb18c49dcbc6adb6 # Parent 65c95094dbb3623e3fe57be8bbcab8536f55cb88 interpolate inline wrapper options diff -r 65c95094dbb3 -r 1f76705df520 pyloader/factory.py --- a/pyloader/factory.py Thu Jun 09 18:07:39 2011 -0700 +++ b/pyloader/factory.py Thu Jun 09 18:21:18 2011 -0700 @@ -132,8 +132,10 @@ # TODO: could interpolate wrapper if wrapper in names: - # TODO: wrapper arguments: + # inline wrapper arguments: # [extended-fibonacci:@:four=4,five=5:fibonacci] + _wrapper_args = None + _wrapper_kwargs = None if ':' in _path: _wrapper_options, __path = path.split(':', 1) if ',' in _wrapper_options or '=' in _wrapper_options: @@ -157,7 +159,19 @@ if wrapper_section in seen: pass # TODO create_section(wrapper_section, iniconfig[wrapper_section]) - wrapper_options = config[wrapper].copy() + wrapper_options = deepcopy(config[wrapper]) + + # add inline wrapper args, kwargs + if _wrapper_args is not None: + if 'args' in wrapper_options: + wrapper_options['args'].extend(_wrapper_args) + else: + wrapper_options['args'] = _wrapper_args + if _wrapper_kwargs is not None: + if 'kwargs' in wrapper_options: + wrapper_options['kwargs'].update(_wrapper_kwargs) + else: + wrapper_options['kwargs'] = _wrapper_kwargs # interpolate wrapper_options def interpolate(option):