[Zope3-checkins] CVS: Zope3/src/zope/app/xml - w3cschemalocations.py:1.4

Jim Fulton jim@zope.com
Wed, 30 Apr 2003 16:13:54 -0400


Update of /cvs-repository/Zope3/src/zope/app/xml
In directory cvs.zope.org:/tmp/cvs-serv29228/src/zope/app/xml

Modified Files:
	w3cschemalocations.py 
Log Message:
zope.app.xml.w3schemalocations.setInstanceInterfaces had a more
sophisticated alogorithm for setting instance interface declarations
than the quick bit of code I put in
zope.interface.declarations.directlyProvides.  I moved this code to
directlyProvides and simplified the code in setInstanceInterfaces to
*just* call directlyProvides.



=== Zope3/src/zope/app/xml/w3cschemalocations.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/xml/w3cschemalocations.py:1.3	Fri Apr 18 18:12:30 2003
+++ Zope3/src/zope/app/xml/w3cschemalocations.py	Wed Apr 30 16:13:23 2003
@@ -41,40 +41,7 @@
     return result
 
 def setInstanceInterfaces(ob, interfaces):
-    #XXX this is really a hack. interfacegeddon will hopefully provide a better
-    # way to do this
-    
-    # if there are no interfaces, then we go back to whatever the class
-    # implements
-    if not interfaces:
-        try:
-            del ob.__implements__
-        except AttributeError:
-            pass
-        return
-
-    cls = ob.__class__
-    if isinstance(cls.__implements__, tuple):
-        implements = list(cls.__implements__)
-    else:
-        implements = [cls.__implements__]
-
-    orig_implements = implements[:]
-        
-    for interface in interfaces:
-        if interface not in implements:
-            implements.append(interface)
-
-    # if there are no changes in the interfaces, go back to whatever
-    # the class implements
-    if implements == orig_implements:
-        try:
-            del ob.__implements__
-        except AttributeError:
-            pass
-        return
-
-    directlyProvides(ob, *implements)
+    directlyProvides(ob, *interfaces)
 
 def getW3CXMLSchemaLocations(xml):
     """Give list of URIs of the schema an XML document promises to implement.