[Zope-Checkins] CVS: Zope/lib/python/Interface - Implements.py:1.4.12.1

Christian 'Tiran' Heimes heimes at faho.rwth-aachen.de
Mon Oct 20 17:41:33 EDT 2003


Update of /cvs-repository/Zope/lib/python/Interface
In directory cvs.zope.org:/tmp/cvs-serv5985/lib/python/Interface

Modified Files:
      Tag: Zope-2_7-branch
	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.4.12.1 ===
--- 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:41:31 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