changeset 60:cc361ad8a692

stub out future directions for decorators and their testing a bit
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 09 Jun 2011 09:07:08 -0700
parents 6b48dee5b92b
children 926caecf385d
files pyloader/factory.py tests/objects.py tests/test.ini
diffstat 3 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pyloader/factory.py	Thu Jun 09 08:17:08 2011 -0700
+++ b/pyloader/factory.py	Thu Jun 09 09:07:08 2011 -0700
@@ -128,13 +128,19 @@
                 # TODO: could interpolate wrapper 
                 if wrapper in names:
 
+                    # TODO: wrapper arguments:
+                    # [extended-fibonacci:@:four=4,five=5:fibonacci]
+
                     # 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
                     # but check for cyclic consistency
-                    wrapped_name = section
+                    if _path in names:
+                        wrapped_name = _path
+                    else:
+                        wrapped_name = section
                     
                     if wrapper not in config:
                         wrapper_section = names[wrapper]
@@ -162,6 +168,8 @@
                     name = wrapped_name
                     path = _path
 
+                    
+
             # make a dict for the section
             path = path % defaults
             sect = config[name] = dict(path=path)
--- a/tests/objects.py	Thu Jun 09 08:17:08 2011 -0700
+++ b/tests/objects.py	Thu Jun 09 09:07:08 2011 -0700
@@ -24,7 +24,7 @@
 class Wrapper(object):
     def __init__(self, app, **values):
         self.app = app
-        self.values = dict([(int(i), j) for i, j in values]) # TODO: should be automagically converted ideally via pyloader
+        self.values = dict([(int(j), i) for i, j in values]) # TODO: should be automagically converted ideally via pyloader
     def __call__(self, *args, **kwargs):
         retval = self.app(*args, **kwargs)
         values = {1: 'one',
--- a/tests/test.ini	Thu Jun 09 08:17:08 2011 -0700
+++ b/tests/test.ini	Thu Jun 09 09:07:08 2011 -0700
@@ -16,3 +16,5 @@
 
 [bar:fibonacci]
 n=1
+
+[extended-fibonacci:@:four=4,five=5:fibonacci]