[Checkins] SVN: martian/trunk/src/martian/core.py Added support for ExtensionClasses, so we can use martian under Zope2.

Lennart Regebro regebro at gmail.com
Sat Apr 26 05:19:17 EDT 2008


Log message for revision 85751:
  Added support for ExtensionClasses, so we can use martian under Zope2.
  

Changed:
  U   martian/trunk/src/martian/core.py

-=-
Modified: martian/trunk/src/martian/core.py
===================================================================
--- martian/trunk/src/martian/core.py	2008-04-26 09:17:21 UTC (rev 85750)
+++ martian/trunk/src/martian/core.py	2008-04-26 09:19:17 UTC (rev 85751)
@@ -8,6 +8,12 @@
                                 GlobalGrokker)
 from martian.error import GrokError
 
+try:
+    from ExtensionClass import ExtensionClass
+    CLASS_TYPES = (type, types.ClassType, ExtensionClass)
+except ImportError:
+    CLASS_TYPES = (type, types.ClassType)
+    
 class MultiGrokkerBase(GrokkerBase):
     implements(IMultiGrokker)
 
@@ -171,7 +177,7 @@
 
     def grokkers(self, name, obj):
         obj_type = type(obj)
-        if obj_type in (type, types.ClassType):
+        if obj_type in CLASS_TYPES:
             return self._multi_class_grokker.grokkers(name, obj)
         elif obj_type is types.ModuleType:
             return self._multi_global_grokker.grokkers(name, obj)



More information about the Checkins mailing list