[Twisted-Python] Problem passing objects with perspective broker
glyph at twistedmatrix.com
Sun Jan 29 19:01:48 EST 2012
On Jan 29, 2012, at 1:28 AM, Fourat ZOUARI wrote:
> 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.
> 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 ...
> Am asking whether if a clean solution exist for such problems.
You have to override getStateToCopy() and setCopyableState() so that only the references that you care about are transferred.
If you want to transfer an object though, you ned to make them copyable. That's the whole point; only classes explicitly marked as copyable are allowed to be transferred. Otherwise, bugs in your code might expose lots more information than you really want to, and remote attackers could create classes that they shouldn't be able to.
More information about the Twisted-Python