[Zodb-checkins] CVS: Zope3/lib/python/Interface/Registry - TypeRegistry.py:1.3
Jeremy Hylton
jeremy@zope.com
Thu, 5 Sep 2002 17:17:34 -0400
Update of /cvs-repository/Zope3/lib/python/Interface/Registry
In directory cvs.zope.org:/tmp/cvs-serv5635
Modified Files:
TypeRegistry.py
Log Message:
Add setdefault() method to TypeRegistry.
Add XXX comment about unclear comment below it.
=== Zope3/lib/python/Interface/Registry/TypeRegistry.py 1.2 => 1.3 ===
--- Zope3/lib/python/Interface/Registry/TypeRegistry.py:1.2 Thu Aug 1 12:06:41 2002
+++ Zope3/lib/python/Interface/Registry/TypeRegistry.py Thu Sep 5 17:17:33 2002
@@ -25,11 +25,13 @@
from ITypeRegistry import ITypeRegistry
class TypeRegistry:
- """Type registry
- """
__implements__ = ITypeRegistry
+ # XXX This comment doesn't seem to be correct, because the mapping is
+ # from interface -> object. There are no tuples that I see. Also,
+ # I'm not sure what the last sentence is trying to say :-).
+
# The implementation uses a mapping:
#
# { (required_interface, provided_interface) ->
@@ -54,6 +56,9 @@
"""
return self._reg.get(interface, default)
+ def setdefault(self, interface, default=None):
+ return self._reg.setdefault(interface, default)
+
def getAll(self, interface_spec):
result = []
for interface in _flatten(interface_spec):
@@ -73,3 +78,4 @@
# account implementation registries for objects that can't
# have '__implements__' attributes.
return self.getAll(getattr(object, '__implements__', None))
+