[Zope3-checkins] CVS: Zope3/src/zope/app - context.py:1.11.12.1
introspector.py:1.13.2.1
Sidnei da Silva
sidnei at x3ng.com.br
Wed Aug 13 10:37:00 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app
In directory cvs.zope.org:/tmp/cvs-serv28777/src/zope/app
Modified Files:
Tag: dreamcatcher-ttwschema-branch
context.py introspector.py
Log Message:
__name__-geddon. Use getName for getting the name of interfaces
=== Zope3/src/zope/app/context.py 1.11 => 1.11.12.1 ===
--- Zope3/src/zope/app/context.py:1.11 Tue Jul 1 19:28:42 2003
+++ Zope3/src/zope/app/context.py Wed Aug 13 09:35:56 2003
@@ -65,17 +65,17 @@
Interfaces of X are ordered with the directly-provided interfaces first
- >>> [interface.__name__ for interface in list(providedBy(x))]
+ >>> [interface.getName() for interface in list(providedBy(x))]
['I4', 'I3']
When we decorate objects, what order should the interfaces come
in? One could argue that decorators are less specific, so they
should come last.
- >>> [interface.__name__ for interface in list(providedBy(D1(x)))]
+ >>> [interface.getName() for interface in list(providedBy(D1(x)))]
['I4', 'I3', 'I1']
- >>> [interface.__name__ for interface in list(providedBy(D2(D1(x))))]
+ >>> [interface.getName() for interface in list(providedBy(D2(D1(x))))]
['I4', 'I3', 'I1', 'I2']
"""
def __get__(self, inst, cls=None):
=== Zope3/src/zope/app/introspector.py 1.13 => 1.13.2.1 ===
--- Zope3/src/zope/app/introspector.py:1.13 Mon Aug 11 12:55:21 2003
+++ Zope3/src/zope/app/introspector.py Wed Aug 13 09:35:56 2003
@@ -200,6 +200,9 @@
ids = [id for id, iface in items
if iface == interface]
if not ids:
- raise ComponentLookupError, interface
+ # 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()
assert len(ids) == 1, "Ambiguous interface names: %s" % ids
return ids[0]
More information about the Zope3-Checkins
mailing list