[Zope3-checkins] CVS: Zope3/lib/python/Interface - Implements.py:1.5
Jeremy Hylton
jeremy@zope.com
Thu, 10 Oct 2002 17:21:04 -0400
Update of /cvs-repository/Zope3/lib/python/Interface
In directory cvs.zope.org:/tmp/cvs-serv20976/lib/python/Interface
Modified Files:
Implements.py
Log Message:
Use isinstance() to test if any object is a class.
=== Zope3/lib/python/Interface/Implements.py 1.4 => 1.5 ===
--- Zope3/lib/python/Interface/Implements.py:1.4 Wed Oct 9 18:34:51 2002
+++ Zope3/lib/python/Interface/Implements.py Thu Oct 10 17:21:03 2002
@@ -32,8 +32,9 @@
_typeImplements = {}
def getImplements(object):
- t = type(object)
- if t in ClassTypes:
+ # Decide whether or not the object is a class. If it is a class,
+ # return it's __class_implements__ rather than its __implements__.
+ if isinstance(object, ClassTypes):
ci = getattr(object, '__class_implements__', None)
if ci is not None:
return ci
@@ -42,7 +43,7 @@
if impl is not None:
return impl
- return _typeImplements.get(t)
+ return _typeImplements.get(type(object))
def getImplementsOfInstances(klass):