[Zodb-checkins] CVS: Zope3/src/zope/interface - verify.py:1.5

Jim Fulton jim at zope.com
Fri Apr 18 10:59:55 EDT 2003


Update of /cvs-repository/Zope3/src/zope/interface
In directory cvs.zope.org:/tmp/cvs-serv1387

Modified Files:
	verify.py 
Log Message:
Added a monkey hook that we can monkey with when using the module from
Zope 2. :)


=== Zope3/src/zope/interface/verify.py 1.4 => 1.5 ===
--- Zope3/src/zope/interface/verify.py:1.4	Thu Mar 13 13:49:14 2003
+++ Zope3/src/zope/interface/verify.py	Fri Apr 18 09:59:54 2003
@@ -17,6 +17,11 @@
 from types import FunctionType, MethodType
 from zope.interface.interface import fromMethod, fromFunction
 
+# This will be monkey-patched when running under Zope 2, so leave this
+# here:
+MethodTypes = (MethodType, )
+
+
 def _verify(iface, candidate, tentative=0, vtype=None):
     """Verify that 'candidate' might correctly implements 'iface'.
 
@@ -50,7 +55,8 @@
         if type(attr) is FunctionType:
             # should never get here
             meth = fromFunction(attr, n)
-        elif type(attr) is MethodType and type(attr.im_func) is FunctionType:
+        elif (isinstance(attr, MethodTypes)
+              and type(attr.im_func) is FunctionType):
             meth = fromMethod(attr, n)
         else:
             continue # must be an attribute...




More information about the Zodb-checkins mailing list