[Grok-dev] Pickling an object stored in the Zodb. How do I skip the __parent__ attribute?

Jegenye 2001 Bt (Miklós Prisznyák) jegenye2001 at gmail.com
Thu Aug 14 09:11:19 EDT 2008


2008/8/14 Sebastian Ware <sebastian at urbantalk.se>

> I am trying to export and import objects from the Zodb using
> cPickle.dumps().
>
> My problem is that the pickler traverses the __parent__ attribute thus
> 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:

http://www.python.org/doc/2.5/lib/node321.html

-- 
Best regards,
   Miklós
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20080814/2d9ea7cc/attachment.html 


More information about the Grok-dev mailing list