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

Jeremy Hylton jhylton at gmail.com
Thu Nov 11 10:52:39 EST 2004


> the server is trying to raise ConflictError, and the ConflictError
> constructor is trying to determine the name of the object's class, by
> loading just enough of the object pickle to get the name.  The
> implementation of pickle does an import in this case (for a pickle GLOBAL
> opcode), but the import failed.
> 
> 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.

It should also work fine if you don't have the code on the server. 
ZEO should raise that exception for a class exactly once in the
process's lifetime.  It's trying to discover if the class has a
conflict resolution method that the server should run.  (We've talked
many times about changing the mechanism ZEO uses so that you can
explicitly configure callables to run on conflicts for a particuar
class.  There's no good reason to make them methods, and it causes
some problems.)

It can occasionally be bad to have client code on the server.  The
problem is that the client code actually gets executed :-).  If the
client code expects to be running inside of Zope, it can actually
start to bring up Zope within the ZEO server.  That's very bad.  In
general, if the code has side-effects at import time, you want to
think carefully about whether you want those side-effects to occur on
your ZEO server.

Jeremy


More information about the ZODB-Dev mailing list