[Zope3-checkins] CVS: Zope3/src/zope/app/introspector - __init__.py:1.2

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Mar 3 12:06:58 EST 2004


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

Modified Files:
	__init__.py 
Log Message:


Bandaid to hide interface service issues. The interface service is about to go
away, so it's not worth trying to fix it.




=== Zope3/src/zope/app/introspector/__init__.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/introspector/__init__.py:1.1	Mon Mar  1 05:18:20 2004
+++ Zope3/src/zope/app/introspector/__init__.py	Wed Mar  3 12:06:57 2004
@@ -28,7 +28,7 @@
 
 from zope.app.introspector.interfaces import IIntrospector
 
-class Introspector:
+class Introspector(object):
     """Introspects an object"""
 
     implements(IIntrospector)
@@ -203,6 +203,7 @@
     interface = removeAllProxies(interface)
     if interface is None:
         return 'None'
+    defaultName = interface.__module__ + '.' + interface.getName()
     service = getService(context, Interfaces)
     items = service.items(base=interface)
     ids = [id for id, iface in items
@@ -211,7 +212,16 @@
         # XXX Do not fail badly, instead resort to the standard
         # way of getting the interface name, cause not all interfaces
         # may be registered.
-        return interface.__module__ + '.' + interface.getName()
+        return defaultName
 
+    if len(ids) == 1:
+        return ids[0]
+
+    # XXX: Band-aid for mal-functioning interface service. Once the interface
+    # service is gone, this method needs to be refactored anyways and the
+    # following two lines should be removed!!!
+    if defaultName in ids:
+        return defaultName
+    
     assert len(ids) == 1, "Ambiguous interface names: %s" % ids
-    return ids[0]
+    




More information about the Zope3-Checkins mailing list