[Grok-dev] Pickling an object stored in the Zodb. How do I skip the __parent__ attribute?
sebastian at urbantalk.se
Fri Aug 15 09:46:11 EDT 2008
thanks. I will look closer at this if I fail on the adapter route.
14 aug 2008 kl. 18.32 skrev Gary Poster:
> Hey Sebastian. http://pypi.python.org/pypi/zc.copy has a pluggable
> pickler that might do exactly what you want, even in one of the
> built-in variations.
> On Aug 14, 2008, at 10:13 AM, Sebastian Ware wrote:
>> Thanks for the pointer! I have read:
>> And found that the pickling is done by calling the method you refered
>> and that it really does exist on the objects in the Zodb. I will
>> override the method by means of an adapter for the root object that I
>> am pickling and remove the attribute [__parent__]. Feels as though
>> this might actually work :)
>> Mvh Sebastian
>> 14 aug 2008 kl. 15.11 skrev Jegenye 2001 Bt (Miklós Prisznyák):
>>> 2008/8/14 Sebastian Ware <sebastian at urbantalk.se>
>>> I am trying to export and import objects from the Zodb using
>>> My problem is that the pickler traverses the __parent__ attribute
>>> returning a much larger object graph than I wish to serialize.
>>> Do I have to subclass the pickler or is there som other smart way of
>>> making it skip the __parent__ attribute?
>>> You could write an adapter (or modify the class of the content
>>> objects itself) to use __setstate__ and __getstate__ , etc:
>>> Best regards,
>>> Grok-dev mailing list
>>> Grok-dev at zope.org
>> Grok-dev mailing list
>> Grok-dev at zope.org
More information about the Grok-dev