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

Gary Poster gary.poster at gmail.com
Mon Mar 16 09:13:44 EDT 2009


On Mar 16, 2009, at 8:39 AM, Martin Aspeli wrote:

> Gary Poster wrote:
>> On Mar 16, 2009, at 4:02 AM, Martin Aspeli wrote:
>>
>>> Hi,
>>>
>>> I *think* this is a bug in zc.relationship, but I'm not quite sure.
>>>
>>> I'm using ZODB3 3.8.1 (to get BLOB support) and trying to install
>>> plone.app.relations, which depends on zc.relationship 1.0.2. In
>>> particular, it  subclasses zc.relationship.shared.Container, and
>>> stores
>>> a zc.relationship.index.Index object in self.relationIndex.
>>>
>>> Now, the __init__ of zc.relationship.index.Index, which derives from
>>> Persistent, contains the code below. In self._relTools and and
>>> self._attrs, there are a pile of modules, types and functions being
>>> stored. I think these are causing the ZODB to barf. Interestingly,
>>> with
>>> whatever version of ZODB that comes with Zope 2.10 (3.7?), there's  
>>> no
>>> problem.
>>>
>>> Any ideas how to work around this, or even why it's a problem in one
>>> version of the ZODB but not another?
>>
>> No idea yet.  What's the barf's traceback?
>
> Mmmm... it seems that zc.relationship 1.1 fixes the issue, but has  
> some
> other problems (an undefined variable minValues or similar - I haven't
> got a build with this version in it right now);

OK.

> 2.0dev seems better,
> albeit a bit scary at pre-alpha.

zc.relationship 2.0 trunk is now essentially a wrapping of zc.relation  
code for backwards compatibility.

You guys are the main clients for zc.relationship at this point, I  
suspect.

As I see it, your relatively reasonable options are these:

- MOST WORK: Move the plone.relation code to depend on zc.relation.   
There is an upgrade path for the old indexes.  You would need to copy  
over the old zc.relationship relationship containers to the Plone  
package.  IIRC, Alec's tests of those bits were good, and you could  
just keep the bits from zc.relationship you needed.  ZODB module path  
issues in legacy databases would be among the more annoying bits of  
this approach, though we all know the usual solutions there.

- LESS WORK: See how zc.relationship trunk works for you.  If it makes  
the code happy, I can release it or help you to do so.  It's certainly  
been sitting around long enough.  Then at least you are sitting  
(indirectly) on top of zc.relation, the package that (for instance)  
Martijn F.'s Grok work exercises.  This would be my preferred  
compromise between effort and migration.  The problem here is that it  
probably does depend on ZODB 3.8, and I'd rather not make the  
zc.relation code support the older spellings, so that's probably out  
for you unless you want to make a concrete counter-proposal in this  
regard.

- LEAST WORK: Figure out what's wrong with zc.relationship 1.1.  What  
you described sounds trivial to fix, and I don't have any ethical  
issues over only supporting the most recent release of the 1.x line,  
so I don't want to think about the earlier releases.  I suspect this  
is what you want.  We can make a 1.1.1 release and you can move on.

Gary


More information about the Zope-Dev mailing list