Commit 1b2025ee authored by Hanno Schlichting's avatar Hanno Schlichting

Removed catalog length migration code. Direct upgrades from Zope 2.7 and...

Removed catalog length migration code. Direct upgrades from Zope 2.7 and earlier are no longer supported.
parent 13032986
......@@ -35,6 +35,10 @@ Bugs Fixed
Restructuring
+++++++++++++
- Removed catalog length migration code. You can no longer directly upgrade a
Zope 2.7 or earlier database to Zope 2.13. Please upgrade to an earlier
release first.
- Deprecated the ``Products.ZCatalog.CatalogAwareness`` and
``CatalogPathAwareness`` modules.
......
......@@ -105,11 +105,7 @@ class HelpTopicBase:
self.index_object()
def get_catalog(self):
c = self.catalog
# Migrate HelpSys catalog (Zope 2.8+)
if not hasattr(c, '_migrated_280'):
c.manage_convertIndexes()
return c
return self.catalog
class HelpTopic(Implicit, HelpTopicBase, Item, PropertyManager, Persistent):
......
......@@ -92,17 +92,9 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
self.updateBrains()
def __len__(self):
return self._length()
def migrate__len__(self):
""" migration of old __len__ magic for Zope 2.8 """
if not hasattr(self, '_length'):
n = self.__dict__['__len__']()
del self.__dict__['__len__']
self._length = BTrees.Length.Length(n)
def clear(self):
""" clear catalog """
......@@ -343,9 +335,6 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
if index is None: # we are inserting new data
index = self.updateMetadata(object, uid)
if not hasattr(self, '_length'):
self.migrate__len__()
self._length.change(1)
self.uids[uid] = index
self.paths[index] = uid
......@@ -398,8 +387,6 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
del data[rid]
del paths[rid]
del uids[uid]
if not hasattr(self, '_length'):
self.migrate__len__()
self._length.change(-1)
else:
......@@ -445,7 +432,8 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
result[name] = self.getIndex(name).getEntryForObject(rid, "")
return result
## This is the Catalog search engine. Most of the heavy lifting happens below
## This is the Catalog search engine. Most of the heavy lifting happens
# below
def make_query(self, request):
# This is a bit of a mess, but the ZCatalog API has traditionally
......@@ -771,7 +759,6 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
return val
return kw.get("sort_%s" % attr, None)
def _getSortIndex(self, args):
"""Returns a search index object or None."""
sort_index_name = self._get_sort_attr("on", args)
......
......@@ -179,23 +179,11 @@ class ZCatalog(Folder, Persistent, Implicit):
self._v_total = 0
self._catalog = Catalog()
self._migrated_280 = True
self.long_query_time = 0.1 # in seconds
def __len__(self):
# Perform a migration of _catalog.__len__ to _catalog._length
# to avoid with new-style class caching issues (see #1332)
self._catalog.migrate__len__()
return len(self._catalog)
# getVocabulary method is no longer supported
# def getVocabulary(self):
# """ more ack! """
# return getattr(self, self.vocab_id)
def manage_edit(self, RESPONSE, URL1, threshold=1000, REQUEST=None):
""" edit the catalog """
if type(threshold) is not type(1):
......@@ -869,59 +857,6 @@ class ZCatalog(Folder, Persistent, Implicit):
self.pgthreshold = 0
return self.pgthreshold
def manage_convertIndexes(self, REQUEST=None, RESPONSE=None, URL1=None):
"""Recreate indexes derived from UnIndex because the implementation of
__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.
"""
LOG.info('Start migration of indexes for %s' % self.absolute_url(1))
for idx in self.Indexes.objectValues():
bases = [str(name) for name in idx.__class__.__bases__]
found = False
if idx.meta_type == 'PathIndex':
found = True
else:
for base in bases:
if 'UnIndex' in base:
found = True
break
if found:
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
LOG.info('Finished migration of indexes for %s' % self.absolute_url(1))
if RESPONSE:
RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message='
'Indexes%20converted%20and%20reindexed')
#
# Indexing methods
#
......
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