[ZODB-Dev] ZODB and ORBit-Python problems
Greg Ward
gward@mems-exchange.org
Fri, 18 May 2001 09:20:32 -0400
On 18 May 2001, Christian Robottom Reis said:
> 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.
It is certainly possible to write extension types that can be pickled:
>>> from cPickle import loads, dumps
>>> from mx.DateTime import now
>>> t = now()
>>> t
<DateTime object for '2001-05-18 09:17:40.40' at 8108810>
>>> type(t)
<type 'DateTime'>
>>> dumps(t)
'cmx.DateTime\n_DT\np1\n(I730623\nF33460.407789945602\ntRp2\n.'
>>> dumps(t,1)
'cmx.DateTime\n_DT\nq\x01(J\xff%\x0b\x00G@\xe0V\x8d\x0c\x9d\x80\x00tRq\x02.'
>>> loads(_)
<DateTime object for '2001-05-18 09:17:40.40' at 81496e8>
We have a ZODB (accessed via ZEO) that uses mx.DateTime objects all over
the place, so putting random extension types into a ZODB is not a
problem.
Can you pickle ORBit-Python objects outside of a ZODB context, ie. does
something like the above dialogue work for O-P objects? If not, it's
O-P's fault for not supporting the pickle protocol. If so, I dunno who
to blame.
Greg
--
Greg Ward - software developer gward@mems-exchange.org
MEMS Exchange http://www.mems-exchange.org