[ZDP] BackTalk to Document Zope Developer's Guide (2.4 edition)/Zope Products
webmaster@zope.org
webmaster@zope.org
Fri, 08 Nov 2002 21:26:17 -0500
A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZDG/current/Products.stx#3-99
---------------
Another solution is to use the standard Python pickling hook
'__setstate__', however, this is in general more error prone and
complex.
% Anonymous User - Nov. 8, 2002 9:26 pm:
I'd like to get examples here.
Instead of pickling, how about including methods for export to/import from disk.
these may be editable strings (__repr__) for export and python eval for import.
caveat: eval doesnt like newlines.
The next more complicated solution is parse/unparse methods for im/export.
This of course must be included in the very first distributed product and then
migrating to a newer version still requires manual work for each instance
(export, delete old instance, create new instance, import).
Or is there a way to modify product instances in the ZODB? example, plz.