[Zope-Checkins] CVS: Zope/lib/python/Interface - verify.py:1.3.154.1
Martijn Pieters
mj@zope.com
Wed, 19 Jun 2002 14:03:47 -0400
Update of /cvs-repository/Zope/lib/python/Interface
In directory cvs.zope.org:/tmp/cvs-serv14581/lib/python/Interface
Modified Files:
Tag: Zope-2_5-branch
verify.py
Log Message:
Fix Interface/verify's extreme brokenness in the face of ExtensionClasses
and attributes.
=== Zope/lib/python/Interface/verify.py 1.3 => 1.3.154.1 ===
import types
+MethodTypes = (types.MethodType,)
+
+try:
+ import ExtensionClass
+except ImportError:
+ # ExtensionClass is not present
+ pass
+else:
+ # ExtensionClass is present
+ class _x(ExtensionClass.Base):
+ def m(self): pass
+
+ MethodTypes += (type(_x.m),)
+
+
def verify_class_implementation(iface, klass):
"""
@@ -26,10 +41,10 @@
attr = getattr(klass, n)
if type(attr) is types.FunctionType:
meth = Method().fromFunction(attr, n)
- elif type(attr) is types.MethodType:
+ elif type(attr) in MethodTypes:
meth = Method().fromMethod(attr, n)
else:
- break # must be an attribute...
+ continue # must be an attribute...
if d.getSignatureInfo() != meth.getSignatureInfo():
raise BrokenMethodImplementation(n)