[ZODB-Dev] zodb wants to import my module?

Tim Peters tim at zope.com
Wed Nov 10 19:45:35 EST 2004


[Tim Peters]
> ...
> I don't have a deep understanding of this part of the code (it's
> complicated and obscure), and it's possible there's a bug.  But, offhand,
> it looks to me like it would work fine if the ZEO server (as well as the
> ZEO client) had your persistent class implementation code.
>
> If it did, the transaction in question still would have failed, but by
> raising ConflictError instead.

Looking some more, that still all appears to be the case, plus some:

ZODB before 3.3 didn't name the class of the object involved in a
ConflictError, and getting it to do so was a semi-popular request.  So the
code that's *trying* to insert the class name is new in 3.3.  It does so by
actually loading "the first part" of the ZODB object pickle, which requires
that the object's class's implementation code exist on the ZEO server.  I
think that's a poor idea, for the reason you discovered.  There's another
way to do it, which doesn't require using pickle.load(), or importing any
application module or class objects.

I expect it wasn't done that way to begin with because no utility function
for doing so exists, but reusable code for getting the class name via
loading a pickle did (or, in 3.3, does) exist.  I'll try to change that.



More information about the ZODB-Dev mailing list