Commit 64b0392c authored by Andreas Jung's avatar Andreas Jung

added implicit migration of HelpSys catalog to avoid AttributeError, _length

failures during the Zope startup phase caused by the index cleanup in Zope 2.8
parent 5757d6e1
......@@ -99,7 +99,11 @@ class HelpTopicBase:
self.index_object()
def get_catalog(self):
return self.catalog
c = self.catalog
# Migrate HelpSys catalog (Zope 2.8+)
if not hasattr(c, '_migrated_280'):
c.manage_convertIndexes()
return c
class HelpTopic(Acquisition.Implicit, HelpTopicBase, Item, PropertyManager, Persistent):
......
......@@ -926,9 +926,11 @@ 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'):
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'):
if idx_type == 'FieldIndex' and idx_id in ('effective',
'expires'):
idx_type = 'DateRangeIndex'
indexed_attrs = getattr(idx, 'indexed_attrs', None)
self.delIndex(idx.getId())
......@@ -938,10 +940,11 @@ class ZCatalog(Folder, Persistent, Implicit):
setattr(new_idx, 'indexed_attrs', indexed_attrs)
self.manage_reindexIndex(idx_id, REQUEST)
self._migrated_280 = True
LOG.info('Finished migration of indexes for %s' % self.absolute_url(1))
RESPONSE.redirect(
URL1 +
if RESPONSE:
RESPONSE.redirect( URL1 +
'/manage_main?manage_tabs_message=Indexes%20converted%20and%20reindexed')
......
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