[Zope-Checkins] SVN: Zope/trunk/lib/python/ added implicit migration of HelpSys catalog to avoid AttributeError, _length

Andreas Jung andreas at andreas-jung.com
Sun Feb 13 06:36:27 EST 2005


Log message for revision 29133:
  added implicit migration of HelpSys catalog to avoid AttributeError, _length
  failures during the Zope startup phase caused by the index cleanup in Zope 2.8
  

Changed:
  U   Zope/trunk/lib/python/HelpSys/HelpTopic.py
  U   Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py

-=-
Modified: Zope/trunk/lib/python/HelpSys/HelpTopic.py
===================================================================
--- Zope/trunk/lib/python/HelpSys/HelpTopic.py	2005-02-13 02:49:44 UTC (rev 29132)
+++ Zope/trunk/lib/python/HelpSys/HelpTopic.py	2005-02-13 11:36:27 UTC (rev 29133)
@@ -99,7 +99,11 @@
         self.index_object()
 
     def get_catalog(self):
-        return self.catalog
+        c = self.catalog
+        # Migrate HelpSys catalog (Zope 2.8+)
+        if not hasattr(c, '_migrated_280'):
+            c.manage_convertIndexes()
+        return c
 
 
 class HelpTopic(Acquisition.Implicit, HelpTopicBase, Item, PropertyManager, Persistent):

Modified: Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py	2005-02-13 02:49:44 UTC (rev 29132)
+++ Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py	2005-02-13 11:36:27 UTC (rev 29133)
@@ -926,9 +926,11 @@
                 idx_type = idx.meta_type
                 idx_id = idx.getId()
                 LOG.info('processing index %s' % idx_id)
-                if idx_type == 'FieldIndex' and idx_id in ('start', 'modified', 'end', 'created'):
+                if idx_type == 'FieldIndex' and idx_id in ('start', 'modified', 
+                                                           'end', 'created'):
                     idx_type = 'DateIndex'
-                if idx_type == 'FieldIndex' and idx_id in ('effective', 'expires'):
+                if idx_type == 'FieldIndex' and idx_id in ('effective', 
+                                                           'expires'):
                     idx_type = 'DateRangeIndex'
                 indexed_attrs = getattr(idx, 'indexed_attrs', None)
                 self.delIndex(idx.getId())
@@ -938,10 +940,11 @@
                     setattr(new_idx, 'indexed_attrs', indexed_attrs)
                 self.manage_reindexIndex(idx_id, REQUEST)
 
+        self._migrated_280 = True
         LOG.info('Finished migration of indexes for %s' % self.absolute_url(1))
 
-        RESPONSE.redirect(
-            URL1 +
+        if RESPONSE:
+            RESPONSE.redirect( URL1 +
             '/manage_main?manage_tabs_message=Indexes%20converted%20and%20reindexed')
 
 



More information about the Zope-Checkins mailing list