Migrating to BTrees 4.x

David Glick <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <[email protected]>
I'm working on updating Plone to support ZODB 4 and 5.

So far most of the blockers are because BTrees 4.x no longer allows using 
keys whose ordering is not well-defined, including None, and there are 
various places where Plone was using None as a key. I understand the reason 
for the restriction and am making progress on making Plone no longer do 
this.

However I'm looking for suggestions on how to handle migrating existing 
BTrees to remove the None key. Plone users are used to first updating the 
software and then running upgrade steps to make any necessary changes to 
the database. However, because of the new restriction, existing BTrees with 
None as a key cannot be unpickled:

  File 
"/Users/davisagli/.buildout/eggs/ZODB-4.4.3-py2.7.egg/ZODB/Connection.py", 
line 899, in setstate
    self._setstate(obj, oid)
  File 
"/Users/davisagli/.buildout/eggs/ZODB-4.4.3-py2.7.egg/ZODB/Connection.py", 
line 956, in _setstate
    self._reader.setGhostState(obj, p)
  File 
"/Users/davisagli/.buildout/eggs/ZODB-4.4.3-py2.7.egg/ZODB/serialize.py", 
line 623, in setGhostState
    obj.__setstate__(state)
TypeError: Object has default comparison

Any ideas about how I can write a migration script to fix these BTree 
instances *after* the BTrees package has been updated? I guess I'm looking 
for a hook to adjust the state for a particular class before __setstate__ 
is called, since BTrees are extension types and I can't override 
__setstate__.

thanks,
David

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.