[Zope3-checkins] CVS: Zope3/src/zope/interface -
declarations.py:1.21
Jim Fulton
jim at zope.com
Mon Apr 5 15:44:00 EDT 2004
Update of /cvs-repository/Zope3/src/zope/interface
In directory cvs.zope.org:/tmp/cvs-serv13293/src/zope/interface
Modified Files:
declarations.py
Log Message:
Added an exception handler for access to __bases__ to give a more
informative error when trying to get implements declarations for non
classes.
=== Zope3/src/zope/interface/declarations.py 1.20 => 1.21 ===
--- Zope3/src/zope/interface/declarations.py:1.20 Fri Feb 20 11:56:50 2004
+++ Zope3/src/zope/interface/declarations.py Mon Apr 5 15:43:59 2004
@@ -332,8 +332,12 @@
spec.inherit = None # old-style implies no inherit
del cls.__implements__ # get rid of the old-style declaration
else:
- spec = Implements(
- *[implementedBy(c) for c in cls.__bases__])
+ try:
+ bases = cls.__bases__
+ except AttributeError:
+ raise TypeError("ImplementedBy called for non-type", cls)
+
+ spec = Implements(*[implementedBy(c) for c in bases])
spec.inherit = cls
spec.__name__ = getattr(cls, '__module__', '?') + '.' + cls.__name__
More information about the Zope3-Checkins
mailing list