<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Sebastion,<br>
<br>
Please let me know if you make headway with this, I've tried a number
of things to make this work, without success.<br>
<br>
Thanks,<br>
<br>
Kevin Smith<br>
<br>
Sebastian Ware wrote:
<blockquote cite="mid:3F7FABF2-7680-452A-86C5-9DD91D89CB33@urbantalk.se"
type="cite">
<pre wrap="">Thanks for the pointer! I have read:
<a class="moz-txt-link-freetext" href="http://www.python.org/dev/peps/pep-0307/">http://www.python.org/dev/peps/pep-0307/</a>
And found that the pickling is done by calling the method you refered
to:
__getstate__()
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):
</pre>
<blockquote type="cite">
<pre wrap="">
2008/8/14 Sebastian Ware <a class="moz-txt-link-rfc2396E" href="mailto:sebastian@urbantalk.se"><sebastian@urbantalk.se></a>
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:
<a class="moz-txt-link-freetext" href="http://www.python.org/doc/2.5/lib/node321.html">http://www.python.org/doc/2.5/lib/node321.html</a>
--
Best regards,
Miklós
_______________________________________________
Grok-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a>
<a class="moz-txt-link-freetext" href="http://mail.zope.org/mailman/listinfo/grok-dev">http://mail.zope.org/mailman/listinfo/grok-dev</a>
</pre>
</blockquote>
<pre wrap=""><!---->
_______________________________________________
Grok-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a>
<a class="moz-txt-link-freetext" href="http://mail.zope.org/mailman/listinfo/grok-dev">http://mail.zope.org/mailman/listinfo/grok-dev</a>
</pre>
</blockquote>
</body>
</html>