[Zope-Checkins] SVN: Zope/branches/ajung-indexes-desuxing-branch/lib/python/Products/ZCatalog/ZCatalog.py migration for CMF indexes added

Andreas Jung andreas at andreas-jung.com
Tue Feb 1 10:17:17 EST 2005


Log message for revision 29011:
  migration for CMF indexes added
  

Changed:
  U   Zope/branches/ajung-indexes-desuxing-branch/lib/python/Products/ZCatalog/ZCatalog.py

-=-
Modified: Zope/branches/ajung-indexes-desuxing-branch/lib/python/Products/ZCatalog/ZCatalog.py
===================================================================
--- Zope/branches/ajung-indexes-desuxing-branch/lib/python/Products/ZCatalog/ZCatalog.py	2005-02-01 15:11:26 UTC (rev 29010)
+++ Zope/branches/ajung-indexes-desuxing-branch/lib/python/Products/ZCatalog/ZCatalog.py	2005-02-01 15:17:17 UTC (rev 29011)
@@ -908,7 +908,8 @@
            __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.
+           classes. CMF indexes on date fields will be converted to DateIndex and 
+           DateRangeIndex.
         """
 
         LOG.info('Start migration of indexes for %s' % self.absolute_url(1))
@@ -925,6 +926,10 @@
                 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'):
+                    idx_type = 'DateIndex'
+                if idx_type == 'FieldIndex' and idx_id in ('effective', 'expires'):
+                    idx_type = 'DateRangeIndex'
                 indexed_attrs = getattr(idx, 'indexed_attrs', None)
                 self.delIndex(idx.getId())
                 self.addIndex(idx_id, idx_type)



More information about the Zope-Checkins mailing list