[Checkins] SVN: martian/branches/paw-manuel-fake-module/ All tests now pass.

Paul Wilson paulalexwilson at gmail.com
Fri Jan 8 10:29:16 EST 2010


Log message for revision 107797:
  All tests now pass. 
  
  Prevented martian from scanning __builtin__ when finding
  directives if class inherits from 'object' somewhere.
  
  

Changed:
  U   martian/branches/paw-manuel-fake-module/buildout.cfg
  U   martian/branches/paw-manuel-fake-module/setup.py
  U   martian/branches/paw-manuel-fake-module/src/martian/context.txt
  U   martian/branches/paw-manuel-fake-module/src/martian/directive.py

-=-
Modified: martian/branches/paw-manuel-fake-module/buildout.cfg
===================================================================
--- martian/branches/paw-manuel-fake-module/buildout.cfg	2010-01-08 15:28:36 UTC (rev 107796)
+++ martian/branches/paw-manuel-fake-module/buildout.cfg	2010-01-08 15:29:16 UTC (rev 107797)
@@ -10,3 +10,4 @@
 [test]
 recipe = zc.recipe.testrunner
 eggs = martian
+       martian[test]

Modified: martian/branches/paw-manuel-fake-module/setup.py
===================================================================
--- martian/branches/paw-manuel-fake-module/setup.py	2010-01-08 15:28:36 UTC (rev 107796)
+++ martian/branches/paw-manuel-fake-module/setup.py	2010-01-08 15:29:16 UTC (rev 107797)
@@ -34,9 +34,9 @@
     zip_safe=False,
     license='ZPL',
     extras_require = dict(
-        'test' = ['manuel',
-                  'manuelpi.fakemodule',
-                 ]
+        test = ['manuel',
+                'manuelpi.fakemodule',
+               ]
         ),
     install_requires=[
     'zope.interface',

Modified: martian/branches/paw-manuel-fake-module/src/martian/context.txt
===================================================================
--- martian/branches/paw-manuel-fake-module/src/martian/context.txt	2010-01-08 15:28:36 UTC (rev 107796)
+++ martian/branches/paw-manuel-fake-module/src/martian/context.txt	2010-01-08 15:29:16 UTC (rev 107797)
@@ -107,9 +107,7 @@
     class B(object):
       pass
 
-  >>> dir(noimplicitcontext)
-  >>> globals().keys()
-  >>> context.bind(get_default=get_default_context).get(noimplicitcontext.B)
+  >>> context.bind(get_default=get_default_context).get(noimplicitcontext.B, module=noimplicitcontext)
   Traceback (most recent call last):
     ...
   GrokError: No module-level context for <class 'manueltest.fake.noimplicitcontext.B'>, please use the 'context' directive.
@@ -124,10 +122,10 @@
    class C(object):
      pass
 
-  >>> context.bind(get_default=get_default_context).get(ambiguouscontext.B)
+  >>> context.bind(get_default=get_default_context).get(ambiguouscontext.C)
   Traceback (most recent call last):
     ... 
-  GrokError: Multiple possible contexts for <class 'manueltest.fake.ambiguouscontext.B'>, please use the 'context' directive.
+  GrokError: Multiple possible contexts for <class 'manueltest.fake.ambiguouscontext.C'>, please use the 'context' directive.
 
 Let's try this with inheritance, where an implicit context is provided
 by a base class defined in another module::

Modified: martian/branches/paw-manuel-fake-module/src/martian/directive.py
===================================================================
--- martian/branches/paw-manuel-fake-module/src/martian/directive.py	2010-01-08 15:28:36 UTC (rev 107796)
+++ martian/branches/paw-manuel-fake-module/src/martian/directive.py	2010-01-08 15:29:16 UTC (rev 107797)
@@ -132,6 +132,8 @@
     """
     error = None
     for base in mro:
+        if base is object:
+            continue
         module_of_base = scan.resolve(base.__module__)
         try:
             if util.is_baseclass(base):
@@ -189,6 +191,8 @@
         mro = inspect.getmro(component)
         # look up module-level directive for this class or its bases
         for base in mro:
+            if base is object:
+                continue
             module_of_base = scan.resolve(base.__module__)
             result = directive.store.get(directive, module_of_base,
                                          _USE_DEFAULT)



More information about the checkins mailing list