[Zope-Checkins] SVN: Zope/trunk/ - Collector #1899: fixed migration issue when using export/import for

Andreas Jung andreas at andreas-jung.com
Thu Sep 15 02:12:24 EDT 2005


Log message for revision 38478:
  
        - Collector #1899: fixed migration issue when using export/import for
          ZCatalog instances
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Products/PluginIndexes/common/UnIndex.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2005-09-15 06:11:40 UTC (rev 38477)
+++ Zope/trunk/doc/CHANGES.txt	2005-09-15 06:12:24 UTC (rev 38478)
@@ -42,6 +42,9 @@
 
     Bugs Fixed
 
+      - Collector #1899: fixed migration issue when using export/import for
+        ZCatalog instances
+
       - Collector #1871: Applied patch to support lists with records using
         ZTUtils.make_query()
 

Modified: Zope/trunk/lib/python/Products/PluginIndexes/common/UnIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/common/UnIndex.py	2005-09-15 06:11:40 UTC (rev 38477)
+++ Zope/trunk/lib/python/Products/PluginIndexes/common/UnIndex.py	2005-09-15 06:12:24 UTC (rev 38478)
@@ -175,7 +175,15 @@
 
             except AttributeError:
                 # index row is an int
-                del self._index[entry]
+                try:
+                    del self._index[entry]
+                except KeyError:
+                    # XXX swallow KeyError because it was probably
+                    # removed and then _length AttributeError raised
+                    pass 
+                if isinstance(self.__len__, BTrees.Length.Length):
+                    self._length = self.__len__
+                    del self.__len__ 
                 self._length.change(-1)
 
             except:
@@ -202,7 +210,14 @@
         # an IntSet and stuff it in first.
         if indexRow is _marker:
             self._index[entry] = documentId
-            self._length.change(1)
+            # XXX _length needs to be migrated to Length object
+            try:
+                self._length.change(1)
+            except AttributeError:
+                if isinstance(self.__len__, BTrees.Length.Length):
+                    self._length = self.__len__
+                    del self.__len__
+                self._length.change(1)
         else:
             try: indexRow.insert(documentId)
             except AttributeError:



More information about the Zope-Checkins mailing list