changeset 51:d44f3e6dcffa

interpolate options
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 08 Jun 2011 22:24:32 -0700
parents 12de7b1bf303
children 9bd1a80e8e91
files pyloader/factory.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pyloader/factory.py	Wed Jun 08 22:17:43 2011 -0700
+++ b/pyloader/factory.py	Wed Jun 08 22:24:32 2011 -0700
@@ -133,6 +133,7 @@
                     # but not for
                     # [foo:bar:fleem]
                     # in the latter case, just use fleem
+                    # but check for cyclic consistency
                     wrapped_name = section
                     
                     if wrapper not in config:
@@ -143,12 +144,17 @@
                     wrapper_options = config[wrapper].copy()
 
                     # TODO interpolate wrapper_options
+                    def interpolate(option):
+                        return option == object_string and wrapped_name or option
                     if 'args' in wrapper_options:
                         args = wrapper_options['args'][:]
+                        args = [interpolate(i) for i in args]
                         wrapper_options['args'] = args
                     if 'kwargs' in wrapper_options:
                         kwargs = wrapper_options['kwargs'].copy()
+                        kwargs = dict([(i,interpolate(j)) for i, j in kwargs.items()])
                         wrapper_options['kwargs'] = kwargs
+                                       
                     path = _path
 
             # make a dict for the section