[Zope-CVS] CVS: Packages/pypes/pypes - extent.py:1.5 services.py:1.5
Casey Duncan
casey at zope.com
Mon Feb 16 00:54:34 EST 2004
Update of /cvs-repository/Packages/pypes/pypes
In directory cvs.zope.org:/tmp/cvs-serv28019
Modified Files:
extent.py services.py
Log Message:
Add convenience accessor for extent service
Fix bug in _remove in ClassExtentMap when the last instance of a class was removed but subclasses remained
Add some integration tests
=== Packages/pypes/pypes/extent.py 1.4 => 1.5 ===
--- Packages/pypes/pypes/extent.py:1.4 Mon Feb 16 00:17:51 2004
+++ Packages/pypes/pypes/extent.py Mon Feb 16 00:54:03 2004
@@ -307,8 +307,17 @@
# of singletons somewhat more expensive. In return __getitem__ can
# be slightly simpler/cheaper which seems worth the trade
del self._instances[key]
- del self._subclasses[key]
-
+ cls = getattr(obj, '__class__', type(obj))
+ for superclass in mro(cls):
+ sclass_key = classKey(superclass)
+ try:
+ subclasses = self._subclasses[sclass_key]
+ subclasses.remove(key)
+ if not subclasses and sclass_key not in self._instances:
+ del self._subclasses[sclass_key]
+ except KeyError:
+ pass
+
class InterfaceExtentMap:
pass
=== Packages/pypes/pypes/services.py 1.4 => 1.5 ===
--- Packages/pypes/pypes/services.py:1.4 Mon Feb 9 16:14:57 2004
+++ Packages/pypes/pypes/services.py Mon Feb 16 00:54:03 2004
@@ -61,6 +61,12 @@
"""
return get(accesspoint, 'event')
+def extent(accesspoint):
+ """Convenience function to access the extent service from accesspoint
+
+ Usage: services.extent(someobj)
+ """
+ return get(accesspoint, 'extent')
def all(accesspoint):
"""Return a dictionary containing all services available from accesspoint
More information about the Zope-CVS
mailing list