[Zope-Checkins] SVN: Zope/trunk/ manage_convertIndexes() did not handle the _since_field and _until_field

Andreas Jung andreas at andreas-jung.com
Mon Jun 27 07:29:23 EDT 2005


Log message for revision 30928:
  manage_convertIndexes() did not handle the _since_field and _until_field
  proeprties properly (in fact they were unhandled)
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2005-06-25 16:58:29 UTC (rev 30927)
+++ Zope/trunk/doc/CHANGES.txt	2005-06-27 11:29:23 UTC (rev 30928)
@@ -39,6 +39,8 @@
       - Collector #1808: manage_convertIndexes no longer tries to change the
         index types causing some trouble with CMF.
 
+      - manage_convertIndexes now handles DateRangeIndexes properly
+
       - WebDAV COPY and MOVE did not call '_notifyOfCopyTo' and
         '_postCopy' hooks like it was done in
         OFS.CopySupport. Additionally added

Modified: Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py	2005-06-25 16:58:29 UTC (rev 30927)
+++ Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py	2005-06-27 11:29:23 UTC (rev 30928)
@@ -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