Commit 1c804ebf authored by Andreas Jung's avatar Andreas Jung

migration for CMF indexes added

parent cbb57740
......@@ -908,7 +908,8 @@ class ZCatalog(Folder, Persistent, Implicit):
__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 @@ class ZCatalog(Folder, Persistent, Implicit):
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)
......
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