[Zope3-checkins] CVS: Zope3/src/zope/app/services - hub.py:1.22
Garrett Smith
cvs-admin at zope.org
Fri Oct 31 18:09:46 EST 2003
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv26456/src/zope/app/services
Modified Files:
hub.py
Log Message:
Removed the implicit (lazy) unregistration of so called missing objects.
Objects that are registered with the hub but cannot, for whatever reason,
be traversed to, represent a bug of some sort and should not be implicitly
deleted.
=== Zope3/src/zope/app/services/hub.py 1.21 => 1.22 ===
--- Zope3/src/zope/app/services/hub.py:1.21 Sun Sep 21 13:32:52 2003
+++ Zope3/src/zope/app/services/hub.py Fri Oct 31 18:09:16 2003
@@ -290,7 +290,6 @@
'''See interface IObjectHub'''
path = self.getPath(hubid)
adapter = getAdapter(self, ITraverser)
- self._verifyPath(path, adapter)
return adapter.traverse(path)
def register(self, path_or_object):
@@ -392,29 +391,25 @@
return index
- def _verifyPath(self, path, traverser=None):
- if traverser is None:
- traverser = getAdapter(self, ITraverser)
- try:
- traverser.traverse(path)
- except NotFoundError, e:
- self.unregister(path)
- raise e
-
-
def _safeTraverse(self, path, traverser):
try:
return traverser.traverse(path)
except NotFoundError:
return None
+
def unregisterMissingObjects(self):
- # XXX temporary method for clearing missing objects - remove when
- # proper unregistration mechanisms are added.
+ """Unregisters all missing objects from the hub.
+
+ Returns the number of objects unregistered.
+
+ An object is missing if it is registered with the hub but cannot
+ be accessed via traversal.
+ """
missing = []
- for object in self.iterObjectRegistrations():
- if object[2] is None:
- missing.append(object[0])
+ for path, hubid, object in self.iterObjectRegistrations():
+ if object is None:
+ missing.append(path)
for path in missing:
self.unregister(path)
return len(missing)
More information about the Zope3-Checkins
mailing list