[Zope-dev] zc.relationship - can't pickle module objects

Martin Aspeli optilude+lists at gmail.com
Mon Mar 16 13:20:17 EDT 2009


Martin Aspeli wrote:
> Gary Poster wrote:
> 
>>> Hopefully. Do we know that zc.relationship 1.1 works with both ZODB
>>> versions?
>> That would be a significant point of its existence, so I certainly  
>> hope so.  I'm 80%+ confident that it does, and would regard not  
>> supporting 3.7 as a bug that I'd be willing to fix.
> 
> Right... so I've just fixed the errors Pyflakes found with 
> zc.relationship 1.1 branch. This now works reliably for my ZODB 3.8.1 build.
> 
> However, it won't install in my ZODB 3.7 environment, because of this 
> line in setup.py:
> 
>   'ZODB3 >= 3.8dev',
> 
> Was that an intentional minimum?

Okay... so, if we remove that restriction, and add the following monkey 
patch to (which is already in plone.relations) to __init__.py, then this 
works on ZODB 3.7 with Zope 2.10, and the tests pass (save for cosmetic 
doctest failures on 3.7 which are easy to fix):

# A tiny monkey patch due to some re-organization of future BTree modules
try:
     from BTrees.OOBTree import BTree
except ImportError:
     import BTrees.OOBTree
     import BTrees.IOBTree
     import BTrees.OIBTree
     import BTrees.IIBTree
     import BTrees.IFBTree
     BTrees.OOBTree.BTree = BTrees.OOBTree.OOBTree
     BTrees.OOBTree.Set = BTrees.OOBTree.OOSet
     BTrees.OOBTree.Bucket = BTrees.OOBTree.OOBucket
     BTrees.OOBTree.TreeSet = BTrees.OOBTree.OOTreeSet
     BTrees.IOBTree.BTree = BTrees.IOBTree.IOBTree
     BTrees.IOBTree.Set = BTrees.IOBTree.IOSet
     BTrees.IOBTree.Bucket = BTrees.IOBTree.IOBucket
     BTrees.IOBTree.TreeSet = BTrees.IOBTree.IOTreeSet
     BTrees.OIBTree.BTree = BTrees.OIBTree.OIBTree
     BTrees.OIBTree.Set = BTrees.OIBTree.OISet
     BTrees.OIBTree.Bucket = BTrees.OIBTree.OIBucket
     BTrees.OIBTree.TreeSet = BTrees.OIBTree.OITreeSet
     BTrees.IIBTree.BTree = BTrees.IIBTree.IIBTree
     BTrees.IIBTree.Set = BTrees.IIBTree.IISet
     BTrees.IIBTree.Bucket = BTrees.IIBTree.IIBucket
     BTrees.IIBTree.TreeSet = BTrees.IIBTree.IITreeSet
     BTrees.IFBTree.BTree = BTrees.IFBTree.IFBTree
     BTrees.IFBTree.Set = BTrees.IFBTree.IFSet
     BTrees.IFBTree.Bucket = BTrees.IFBTree.IFBucket
     BTrees.IFBTree.TreeSet = BTrees.IFBTree.IFTreeSet


Shall I just check that in + the removal of the minimum version pin?

If we do that, then we can let plone.relations depend on zc.relationship 
1.1.1 explicitly and have support for both ZODB versions, which would be 
nice.

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the Zope-Dev mailing list