[Zope3-dev] Interface.Implements module still broken for 2.2 metaclasses

Steve Alexander steve@cat-box.net
Mon, 08 Jul 2002 17:52:22 +0100


Phillip J. Eby wrote:
> 
> def getImplements(object):
>     t = type(object)
>     if t in ClassTypes:
>         if hasattr(object, '__class_implements__'):
>             return object.__class_implements__
>     elif hasattr(object, '__implements__'):
>         return object.__implements__
> 
>     return _typeImplements.get(t, None)
> 
> 
> def getImplementsOfInstances(klass, tiget=_typeImplements.get):
>     if type(klass) in ClassTypes:
>         if hasattr(klass, '__implements__'):
>             return klass.__implements__
>         else:
>             return None
>     else:
>         return tiget(klass, None)
> 
> 
> 
> I believe they should read as follows:
> 
> def getImplements(object):
> 
>     if isinstance(object,ClassTypes):
>         if hasattr(object, '__class_implements__'):
>             return object.__class_implements__
>     elif hasattr(object, '__implements__'):
>         return object.__implements__
> 
>     return _typeImplements.get(type(object), None)
> 
> 
> def getImplementsOfInstances(klass, tiget=_typeImplements.get):
>     if isinstance(klass,ClassTypes):
>         if hasattr(klass, '__implements__'):
>             return klass.__implements__
>         else:
>             return None
>     else:
>         return tiget(klass, None)


With these changes to Interface/Implements.py, all Zope 3 tests continue 
to pass, and I can't detect anything functionally different about Zope 3 
running. I tried it with Zope3 from CVS Trunk, and Python 2.2.1.

--
Steve Alexander