[Zope3-checkins]
SVN: Zope3/branches/jim-index/src/zope/app/catalog/catalog.py
Changed to subclass BTreeContainer. SampleContainer
Jim Fulton
jim at zope.com
Wed Aug 18 15:21:12 EDT 2004
Log message for revision 27177:
Changed to subclass BTreeContainer. SampleContainer
doesn't handle persistence correctly unless to override
a method that is meant to be overridden.
Changed:
U Zope3/branches/jim-index/src/zope/app/catalog/catalog.py
-=-
Modified: Zope3/branches/jim-index/src/zope/app/catalog/catalog.py
===================================================================
--- Zope3/branches/jim-index/src/zope/app/catalog/catalog.py 2004-08-18 19:20:21 UTC (rev 27176)
+++ Zope3/branches/jim-index/src/zope/app/catalog/catalog.py 2004-08-18 19:21:11 UTC (rev 27177)
@@ -19,7 +19,7 @@
from zope.interface import implements
from zope.app.zapi import getUtility
from zope.security.proxy import trustedRemoveSecurityProxy
-from zope.app.container.sample import SampleContainer
+from zope.app.container.btree import BTreeContainer
from zope.app import zapi
from zope.app.annotation.interfaces import IAttributeAnnotatable
@@ -46,7 +46,7 @@
yield obj
-class Catalog(Persistent, SampleContainer):
+class Catalog(BTreeContainer):
implements(ICatalog, IContainer, IAttributeAnnotatable, ILocalUtility)
@@ -134,17 +134,15 @@
"""A subscriber to ObjectModifiedEvent"""
for cat in zapi.getAllUtilitiesRegisteredFor(ICatalog):
ob = event.object
- id = zapi.getUtility(IUniqueIdUtility, context=cat).getId(ob)
- cat.index_doc(id, ob)
+ id = zapi.getUtility(IUniqueIdUtility, context=cat).queryId(ob)
+ if id is not None:
+ cat.index_doc(id, ob)
def unindexDocSubscriber(event):
"""A subscriber to UniqueIdRemovedEvent"""
for cat in zapi.getAllUtilitiesRegisteredFor(ICatalog):
ob = event.original_event.object
- try:
- id = zapi.getUtility(IUniqueIdUtility, context=cat).getId(ob)
- except KeyError:
- pass
- else:
+ id = zapi.getUtility(IUniqueIdUtility, context=cat).queryId(ob)
+ if id is not None:
cat.unindex_doc(id)
More information about the Zope3-Checkins
mailing list