[Zope3-checkins] CVS: Packages3/Interface - Implements.py:1.13
Gary Poster
gary at zope.com
Tue Jan 20 12:31:17 EST 2004
Update of /cvs-repository/Packages3/Interface
In directory cvs.zope.org:/tmp/cvs-serv18412
Modified Files:
Implements.py
Log Message:
Fixed to work with Zope 3 head.
=== Packages3/Interface/Implements.py 1.12 => 1.13 ===
--- Packages3/Interface/Implements.py:1.12 Fri Jun 13 10:42:14 2003
+++ Packages3/Interface/Implements.py Tue Jan 20 12:30:46 2004
@@ -22,8 +22,9 @@
from zope.interface import classImplements as assertTypeImplements
from zope.interface import providedBy as objectImplements
from zope.interface import implementedBy as instancesOfObjectImplements
+from zope.interface.declarations import Declaration
+from Interface.Exceptions import BadImplements
-from zope.interface.declarations import InterfaceSpecification
def visitImplements(implements, object, visitor):
"""Call visitor for each interace.
@@ -32,8 +33,12 @@
If the visitor returns anything true, the loop stops.
This does not, and should not, visit superinterfaces.
"""
-
- for interface in InterfaceSpecification(implements):
+ # used little, so not worrying too much about efficiency or cheesiness
+ try:
+ seq = Declaration(implements)
+ except TypeError:
+ raise BadImplements
+ for interface in seq:
if visitor(interface):
break
More information about the Zope3-Checkins
mailing list