[CMF-checkins] SVN: CMF/trunk/C - CMFUid: Removed redundant and
unexpected code to auto-create catalog
Jens Vagelpohl
jens at dataflake.org
Wed Jun 6 10:13:38 EDT 2007
Log message for revision 76422:
- CMFUid: Removed redundant and unexpected code to auto-create catalog
index and column for the UID handler tool. The index and column are
already created by the default CMFUid GenericSetup profile.
(http://www.zope.org/Collectors/CMF/472)
Changed:
U CMF/trunk/CHANGES.txt
U CMF/trunk/CMFUid/UniqueIdHandlerTool.py
U CMF/trunk/CMFUid/tests/test_uidhandling.py
-=-
Modified: CMF/trunk/CHANGES.txt
===================================================================
--- CMF/trunk/CHANGES.txt 2007-06-06 14:12:21 UTC (rev 76421)
+++ CMF/trunk/CHANGES.txt 2007-06-06 14:13:36 UTC (rev 76422)
@@ -8,6 +8,11 @@
Others
+ - CMFUid: Removed redundant and unexpected code to auto-create catalog
+ index and column for the UID handler tool. The index and column are
+ already created by the default CMFUid GenericSetup profile.
+ (http://www.zope.org/Collectors/CMF/472)
+
- interfaces: Removed deprecated oldstyle interfaces.
- CMFCore.MembershipTool: Removed ancient LoginManager compatibility code
Modified: CMF/trunk/CMFUid/UniqueIdHandlerTool.py
===================================================================
--- CMF/trunk/CMFUid/UniqueIdHandlerTool.py 2007-06-06 14:12:21 UTC (rev 76421)
+++ CMF/trunk/CMFUid/UniqueIdHandlerTool.py 2007-06-06 14:13:36 UTC (rev 76422)
@@ -78,16 +78,9 @@
security = ClassSecurityInfo()
def _reindexObject(self, obj):
- # add uid index and colums to catalog if not yet done
- UID_ATTRIBUTE_NAME = self.UID_ATTRIBUTE_NAME
catalog = getUtility(ICatalogTool)
- if UID_ATTRIBUTE_NAME not in catalog.indexes():
- catalog.addIndex(UID_ATTRIBUTE_NAME, 'FieldIndex')
- catalog.addColumn(UID_ATTRIBUTE_NAME)
+ catalog.reindexObject(obj, idxs=[self.UID_ATTRIBUTE_NAME])
- # reindex
- catalog.reindexObject(obj, idxs=[UID_ATTRIBUTE_NAME])
-
def _setUid(self, obj, uid):
"""Attaches a unique id to the object and does reindexing.
"""
Modified: CMF/trunk/CMFUid/tests/test_uidhandling.py
===================================================================
--- CMF/trunk/CMFUid/tests/test_uidhandling.py 2007-06-06 14:12:21 UTC (rev 76421)
+++ CMF/trunk/CMFUid/tests/test_uidhandling.py 2007-06-06 14:13:36 UTC (rev 76422)
@@ -66,6 +66,11 @@
sm.registerUtility(self.root.portal_uidgenerator, IUniqueIdGenerator)
sm.registerUtility(self.root.portal_uidhandler, IUniqueIdHandler)
+ # Make sure we have our indices/columns
+ uid_name = self.root.portal_uidhandler.UID_ATTRIBUTE_NAME
+ self.root.portal_catalog.addIndex(uid_name, 'FieldIndex')
+ self.root.portal_catalog.addColumn(uid_name)
+
def tearDown(self):
cleanUp()
SecurityTest.tearDown(self)
More information about the CMF-checkins
mailing list