[Zope-dev] pickling limitation in external methods?

Wolf Logan wolf@searchbutton.com
Tue, 4 May 1999 11:39:19 -0700


----- Original Message -----
From: Jim Fulton <jim@digicool.com>
Sent: Tuesday, May 04, 1999 4:53 AM


> > TypeError: read-only buffer, class
> > -----
>
> This is probably due to a bug in the ExternalMethod error handling.
> It assumes that the error type is a string, when it is really a
> class.  Check the indicated source line.  This will be fixed in the
> next release.

i suspected so. thanks.

> Are mxDateTime objects picklable?
>
> If you create one and bind it to 'd', does the following
> code work:
>
>   cPickle.loads(cPickle.dumps(d))
>
> does it return a copy of d?

yup. they are picklable objects in general. the mxDateTime package registers
the types so that the pickle and cPickle modules can handle them properly.
that's why the code works when run under "raw" python, and why i suspected
an incompatibility with the cPickle module that comes with win32 ZOPE. but
replacing that module with one that is known to work with mxDateTime didn't
help.

> P.S.  There is an issue with pickling
>       instances of classes defined in external
>       method files.  These files are not real modules
>       and can't work with the pickling machinery.  This
>       may change in the future.

the DateTime object is defined by mxDateTime, which is a package outside the
pseudo-module being "imported" by ExternalMethod.