[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ manage_convertIndexes did not handle DateRangeIndexes properly

Andreas Jung andreas at andreas-jung.com
Tue Jun 28 06:02:28 EDT 2005


Log message for revision 30939:
  manage_convertIndexes did not handle DateRangeIndexes properly
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/Products/ZCatalog/ZCatalog.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2005-06-27 21:52:14 UTC (rev 30938)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2005-06-28 10:02:27 UTC (rev 30939)
@@ -49,6 +49,8 @@
       - Collector #1808: manage_convertIndexes no longer tries to change the
         index types causing some trouble with CMF.
 
+      - manage_convertIndexes did not treat DateRangeIndexes properly
+
   Zope 2.8.0 (2005/06/11)
 
     Bugs Fixed

Modified: Zope/branches/Zope-2_8-branch/lib/python/Products/ZCatalog/ZCatalog.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Products/ZCatalog/ZCatalog.py	2005-06-27 21:52:14 UTC (rev 30938)
+++ Zope/branches/Zope-2_8-branch/lib/python/Products/ZCatalog/ZCatalog.py	2005-06-28 10:02:27 UTC (rev 30939)
@@ -917,8 +917,7 @@
            __len__ changed in Zope 2.8. Pre-Zope 2.7 installation used to implement
            __len__ as persistent attribute of the index instance which is totally
            incompatible with the new extension class implementation based on new-style
-           classes. CMF indexes on date fields will be converted to DateIndex and 
-           DateRangeIndex.
+           classes. 
         """
 
         LOG.info('Start migration of indexes for %s' % self.absolute_url(1))
@@ -935,12 +934,24 @@
                 idx_type = idx.meta_type
                 idx_id = idx.getId()
                 LOG.info('processing index %s' % idx_id)
+
                 indexed_attrs = getattr(idx, 'indexed_attrs', None)
+
+                if idx.meta_type == 'DateRangeIndex':
+                    since_field = getattr(idx, '_since_field', None)
+                    until_field = getattr(idx, '_until_field', None)
+
                 self.delIndex(idx.getId())
                 self.addIndex(idx_id, idx_type)
                 new_idx = self.Indexes[idx_id]
+
                 if indexed_attrs:
                     setattr(new_idx, 'indexed_attrs', indexed_attrs)
+
+                if idx.meta_type == 'DateRangeIndex':
+                    setattr(new_idx, '_since_field',  since_field)
+                    setattr(new_idx, '_until_field', until_field)
+
                 self.manage_reindexIndex(idx_id, REQUEST)
 
         self._migrated_280 = True



More information about the Zope-Checkins mailing list