[ZODB-Dev] ZODB and ORBit-Python problems

Christian Robottom Reis kiko@async.com.br
Fri, 18 May 2001 02:27:22 -0300 (BRT)


Hello there,

I'm working on getting ORBit-Python and ZODB working together lately, and
I've hacked tonight a minimal working set of changes into O-P. However,
even though I get creation and method call correctly, ZODB now doesn't
want to pickle my objects, since they are of a C type defined in O-P.

Let me elaborate a bit:

In O-P, I make an object ORBit-aware by inheriting from a base __POA
class, which is created automagically by ORBit-Python from the IDL I'm
parsing. Thus:

class Model(Stoq.Model__POA):
	pass

defines a Model class that, when instantiated and activated, becomes a
CORBA servant.

Now my next step was making Model persistent, in the fashion of:

class Model(Stoq.Model__POA,Persistence.Persistent):
	pass

Now this wasn't supported by O-P, but it's been hacked to look through the
base classes until it finds the attributed or methods it needs. So I can
instantiate Models fine and create remote references to them and
manipulate them at will.

However, when it comes to actually commit()ing what I've changed, it
fails. I provide a sync() method on the Factory class that takes care of
instantiation that in turn calls get_transaction().commit(), but see what
happens:

Traceback (most recent call last):
  File "Model.py", line 13, in sync
    get_transaction().commit()
  File "/usr/local/lib/python2.1/site-packages/ZODB/Transaction.py", line
302, in commit
    j.commit(o,self)
  File "/usr/local/lib/python2.1/site-packages/ZODB/Connection.py", line
387, in commit
    dump(state)
cPickle.UnpickleableError: Cannot pickle <type 'Stoq.Model'>
objects

Which is understandable, since the objects _are_ Stoq.Model objects.

Is there a solution to this, even though I'm using MI? Or should I be
doing things differently? I'm not very familiar with C-defined Python
types, and specially not ExtensionClass objects, but I feel perhaps we
could get this to just work. Any help is much appreciated.

Take care,
--
/\/\ Christian Reis, Senior Engineer, Async Open Source, Brazil
~\/~ http://async.com.br/~kiko/ | [+55 16] 274 4311