[CMF-checkins] CVS: CMF/CMFUid - UniqueIdGeneratorTool.py:1.8 UniqueIdHandlerTool.py:1.12 interfaces.py:1.10

Grégoire Weber zope.org at incept.ch
Fri Aug 6 18:58:39 EDT 2004


Update of /cvs-repository/CMF/CMFUid
In directory cvs.zope.org:/tmp/cvs-serv29268

Modified Files:
	UniqueIdGeneratorTool.py UniqueIdHandlerTool.py interfaces.py 
Log Message:
- added 'convert' method which converts a string type uid to the right type (query strings are strings and never integers)


=== CMF/CMFUid/UniqueIdGeneratorTool.py 1.7 => 1.8 ===
--- CMF/CMFUid/UniqueIdGeneratorTool.py:1.7	Fri Aug  6 04:57:11 2004
+++ CMF/CMFUid/UniqueIdGeneratorTool.py	Fri Aug  6 18:58:08 2004
@@ -65,5 +65,10 @@
         """
         self._uid_counter.change(+1)
         return self._uid_counter()
+        
+    def convert(self, uid):
+        """See IUniqueIdGenerator.
+        """
+        return int(uid)
 
 InitializeClass(UniqueIdGeneratorTool)


=== CMF/CMFUid/UniqueIdHandlerTool.py 1.11 => 1.12 ===
--- CMF/CMFUid/UniqueIdHandlerTool.py:1.11	Fri Aug  6 17:00:04 2004
+++ CMF/CMFUid/UniqueIdHandlerTool.py	Fri Aug  6 18:58:08 2004
@@ -136,6 +136,10 @@
         if uid is None:
             return default
         
+        # convert the uid to the right format
+        generator = getToolByName(self, 'portal_uidgenerator')
+        uid = generator.convert(uid)
+        
         catalog = getToolByName(self, 'portal_catalog')
         searchMethod = getattr(catalog, searchMethodName)
         result = searchMethod({self.UID_ATTRIBUTE_NAME: uid})


=== CMF/CMFUid/interfaces.py 1.9 => 1.10 ===
--- CMF/CMFUid/interfaces.py:1.9	Fri Aug  6 17:07:03 2004
+++ CMF/CMFUid/interfaces.py	Fri Aug  6 18:58:08 2004
@@ -35,6 +35,13 @@
         """Return a unique id value.
         """
 
+    def convert(uid):
+        """Converts the unique id from string type to the appropriate
+           uid type.
+           
+        The resulting type has to be the same as the one '__call__'
+        returns.
+        """
 
 class IUniqueIdAnnotationManagement(Interface):
     """Manage unique id annotations.



More information about the CMF-checkins mailing list