[Zope-Checkins] CVS: Zope2 - Catalog.py:1.60.2.2.6.8

Jim Fulton jim@digiciool.com
Wed, 14 Mar 2001 10:42:30 -0500 (EST)


Update of /cvs-repository/Zope2/lib/python/Products/ZCatalog
In directory korak:/tmp/cvs-serv3825

Modified Files:
      Tag: Catalog-BTrees-Integration
	Catalog.py 
Log Message:
Unique IDs passed to catalog_objects *MUST* now be strings.
We'll find out if this causes any problems during the beta period.

Fixed bug: the uid and path indexes were updated needlessly on
updates.




--- Updated File Catalog.py in package Zope2 --
--- Catalog.py	2001/03/02 17:04:09	1.60.2.2.6.7
+++ Catalog.py	2001/03/14 15:42:30	1.60.2.2.6.8
@@ -104,6 +104,8 @@
 import BTrees.Length
 from SearchIndex.randid import randid
 
+StringType=type('')
+
 import time
 
 def orify(seq,
@@ -384,6 +386,10 @@
         'uid' is the unique Catalog identifier for this object
 
         """
+
+        if type(uid) is not StringType:
+            raise CatalogError('The object uniqie id must be a string.')
+        
         data = self.data
 
         # meta_data is stored as a tuple for efficiency
@@ -428,8 +434,8 @@
             try: self.__len__.change(1)
             except AttributeError: pass # No managed length (old-style)
                     
-        self.uids[uid] = index
-        self.paths[index] = uid
+            self.uids[uid] = index
+            self.paths[index] = uid
             
         total = 0
         for x in self.indexes.values():