[Zope-Checkins] CVS: Zope/lib/python/Interface - Implements.py:1.5
Christian 'Tiran' Heimes
heimes at faho.rwth-aachen.de
Mon Oct 20 17:44:10 EDT 2003
Update of /cvs-repository/Zope/lib/python/Interface
In directory cvs.zope.org:/tmp/cvs-serv6492/lib/python/Interface
Modified Files:
Implements.py
Log Message:
flattenInterfaces now walks recursivly into tuples. Tuples are used if the __implements__ declaration is like (IFoo.__implements__, IBar)
=== Zope/lib/python/Interface/Implements.py 1.4 => 1.5 ===
--- Zope/lib/python/Interface/Implements.py:1.4 Wed Feb 12 03:46:09 2003
+++ Zope/lib/python/Interface/Implements.py Mon Oct 20 17:44:10 2003
@@ -128,10 +128,19 @@
for b in bases:
_flatten(b, append)
+def _detuplize(interface, append):
+ if type(interface) is TupleType:
+ for subinterface in interface:
+ _detuplize(subinterface, append)
+ else:
+ append(interface)
def flattenInterfaces(interfaces, remove_duplicates=1):
+ detupledInterfaces = []
+ for interface in interfaces:
+ _detuplize(interface, detupledInterfaces.append)
res = []
- for i in interfaces:
+ for i in detupledInterfaces:
_flatten(i, res.append)
if remove_duplicates:
# Remove duplicates in reverse.
More information about the Zope-Checkins
mailing list