Commit 3af78da2 authored by Andreas Jung's avatar Andreas Jung

manage_convertIndexes did not handle DateRangeIndexes properly

parent 0f2f0447
...@@ -49,6 +49,8 @@ Zope Changes ...@@ -49,6 +49,8 @@ Zope Changes
- Collector #1808: manage_convertIndexes no longer tries to change the - Collector #1808: manage_convertIndexes no longer tries to change the
index types causing some trouble with CMF. index types causing some trouble with CMF.
- manage_convertIndexes did not treat DateRangeIndexes properly
Zope 2.8.0 (2005/06/11) Zope 2.8.0 (2005/06/11)
Bugs Fixed Bugs Fixed
......
...@@ -917,8 +917,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -917,8 +917,7 @@ class ZCatalog(Folder, Persistent, Implicit):
__len__ changed in Zope 2.8. Pre-Zope 2.7 installation used to implement __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 __len__ as persistent attribute of the index instance which is totally
incompatible with the new extension class implementation based on new-style incompatible with the new extension class implementation based on new-style
classes. CMF indexes on date fields will be converted to DateIndex and classes.
DateRangeIndex.
""" """
LOG.info('Start migration of indexes for %s' % self.absolute_url(1)) LOG.info('Start migration of indexes for %s' % self.absolute_url(1))
...@@ -935,12 +934,24 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -935,12 +934,24 @@ class ZCatalog(Folder, Persistent, Implicit):
idx_type = idx.meta_type idx_type = idx.meta_type
idx_id = idx.getId() idx_id = idx.getId()
LOG.info('processing index %s' % idx_id) LOG.info('processing index %s' % idx_id)
indexed_attrs = getattr(idx, 'indexed_attrs', None) 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.delIndex(idx.getId())
self.addIndex(idx_id, idx_type) self.addIndex(idx_id, idx_type)
new_idx = self.Indexes[idx_id] new_idx = self.Indexes[idx_id]
if indexed_attrs: if indexed_attrs:
setattr(new_idx, 'indexed_attrs', 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.manage_reindexIndex(idx_id, REQUEST)
self._migrated_280 = True self._migrated_280 = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment