[Zope-Checkins] SVN: Zope/trunk/ Removed catalog length migration code. Direct upgrades from Zope 2.7 and earlier are no longer supported.
Hanno Schlichting
hannosch at hannosch.eu
Sun Aug 1 08:52:08 EDT 2010
Log message for revision 115322:
Removed catalog length migration code. Direct upgrades from Zope 2.7 and earlier are no longer supported.
Changed:
U Zope/trunk/doc/CHANGES.rst
U Zope/trunk/src/HelpSys/HelpTopic.py
U Zope/trunk/src/Products/ZCatalog/Catalog.py
U Zope/trunk/src/Products/ZCatalog/ZCatalog.py
-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst 2010-08-01 12:37:42 UTC (rev 115321)
+++ Zope/trunk/doc/CHANGES.rst 2010-08-01 12:52:08 UTC (rev 115322)
@@ -35,6 +35,10 @@
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.
Modified: Zope/trunk/src/HelpSys/HelpTopic.py
===================================================================
--- Zope/trunk/src/HelpSys/HelpTopic.py 2010-08-01 12:37:42 UTC (rev 115321)
+++ Zope/trunk/src/HelpSys/HelpTopic.py 2010-08-01 12:52:08 UTC (rev 115322)
@@ -105,11 +105,7 @@
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):
Modified: Zope/trunk/src/Products/ZCatalog/Catalog.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/Catalog.py 2010-08-01 12:37:42 UTC (rev 115321)
+++ Zope/trunk/src/Products/ZCatalog/Catalog.py 2010-08-01 12:52:08 UTC (rev 115322)
@@ -92,17 +92,9 @@
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 @@
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 @@
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 @@
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 @@
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)
Modified: Zope/trunk/src/Products/ZCatalog/ZCatalog.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/ZCatalog.py 2010-08-01 12:37:42 UTC (rev 115321)
+++ Zope/trunk/src/Products/ZCatalog/ZCatalog.py 2010-08-01 12:52:08 UTC (rev 115322)
@@ -179,23 +179,11 @@
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 @@
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
#
More information about the Zope-Checkins
mailing list