[CMF-checkins] CVS: CMF/CMFUid - UniqueIdHandlerTool.py:1.6
Grégoire Weber
zope.org at incept.ch
Thu Jul 22 09:43:14 EDT 2004
Update of /cvs-repository/CMF/CMFUid
In directory cvs.zope.org:/tmp/cvs-serv14303
Modified Files:
UniqueIdHandlerTool.py
Log Message:
- refactorings due to having moved annotation code to UniqueIdAnnotationTool.py
=== CMF/CMFUid/UniqueIdHandlerTool.py 1.5 => 1.6 ===
--- CMF/CMFUid/UniqueIdHandlerTool.py:1.5 Wed Jul 21 00:06:30 2004
+++ CMF/CMFUid/UniqueIdHandlerTool.py Thu Jul 22 09:43:14 2004
@@ -49,7 +49,7 @@
meta_type = 'Unique Id Handler Tool'
# make the uid attribute name available for the unit tests
- # not meant to be altered!!!
+ # not meant to be altered as long you don't know what you do!!!
UID_ATTRIBUTE_NAME = UID_ATTRIBUTE_NAME
# make the exception class available through the tool
@@ -98,17 +98,17 @@
"""
uid = self.queryUid(obj, default=None)
if uid is None:
- UID_ATTRIBUTE_NAME = self.UID_ATTRIBUTE_NAME
+ # attach a unique id annotation to the object
+ anno_tool = getToolByName(self, 'portal_uidannotation')
+ annotation = anno_tool(obj, self.UID_ATTRIBUTE_NAME)
+
+ # initialize the annotation with a (new) unique id
generator = getToolByName(self, 'portal_uidgenerator')
uid = generator()
- setattr(obj, UID_ATTRIBUTE_NAME, uid)
- uid.setId(UID_ATTRIBUTE_NAME)
+ annotation.setUid(uid)
# reindex the object
self._reindexObject(obj)
-
- # return uid not uid object
- uid = uid()
return uid
More information about the CMF-checkins
mailing list