<div dir="ltr">I didnt make bClass as copyable and unjellyed it just for the question, in fact, the example i gave was the bare minimum of my source code to let people clearly view the issue.<div><br></div><div>In the real problem, aClass has many references to other objects and if i were to set them all as copyable and then unjellyed them all on the server side, that would be a headache ...</div>
<div><br></div><div>Am asking whether if a clean solution exist for such problems.<br>
<br><br><div class="gmail_quote">On Sun, Jan 29, 2012 at 7:11 AM, David Ripton <span dir="ltr">&lt;<a href="mailto:dripton@ripton.net">dripton@ripton.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 01/29/12 00:57, Fourat ZOUARI wrote:<br>
<br>
&gt; Whenever i try to pass an object (aClass) with a property with a second<br>
&gt; object (bClass) Am getting:<br>
&gt;<br>
</div>&gt;     *Unpersistable(&#39;Unpersistable data: instance of class amodule.bClass<br>
&gt;     deemed insecure&#39;)*<br>
<div><div class="h5">&gt;<br>
&gt;<br>
&gt; The aClass is copyable and unjellied, the bClass is not.<br>
&gt;<br>
&gt; Here&#39;s my code:<br>
&gt;<br>
&gt; server.py:<br>
&gt;<br>
&gt;     from twisted.application import internet, service<br>
&gt;     from twisted.spread import pb<br>
&gt;     from amodule import PBServer<br>
&gt;<br>
&gt;     application = service.Application(&quot;Test app&quot;)<br>
&gt;<br>
&gt;     # Prepare managers<br>
&gt;     clientManager = internet.TCPServer(8282,<br>
&gt;     pb.PBServerFactory(PBServer()));<br>
&gt;     clientManager.setServiceParent(application)<br>
&gt;<br>
&gt;     if __name__ == &#39;__main__&#39;:<br>
&gt;          print &quot;Run with twistd&quot;<br>
&gt;          import sys<br>
&gt;          sys.exit(1)<br>
&gt;<br>
&gt;<br>
&gt; amodule.py:<br>
&gt;<br>
&gt;     from twisted.spread import pb<br>
&gt;<br>
&gt;     class bClass:<br>
&gt;     &quot;&quot;&quot;This is not a Copyable class<br>
&gt;     &quot;&quot;&quot;<br>
&gt;<br>
&gt;     class aClass(pb.RemoteCopy, pb.Copyable):<br>
&gt;          b = bClass()<br>
&gt;     pb.setUnjellyableForClass(aClass, aClass)<br>
&gt;<br>
&gt;     class PBServer(pb.Root):<br>
&gt;          def remote_echo(self, a):<br>
&gt;              return a.b<br>
&gt;<br>
&gt; Is there anyway to unjelly aClass and all the objects it can contain ?<br>
&gt; because unjellying included object is a headache and may turn into dirty<br>
&gt; code ...<br>
<br>
</div></div>If you make bClass inherit from pb.Copyable and do<br>
pb.setUnjellyableForClass(bClass, bClass) then everything should work.<br>
<br>
Twisted knows how to do what you want, but it&#39;s refusing to do because<br>
you haven&#39;t marked bClass as safe to pass over the wire.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
David Ripton    <a href="mailto:dripton@ripton.net">dripton@ripton.net</a><br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</font></span></blockquote></div><br></div></div>