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. On Sun, Jan 29, 2012 at 7:11 AM, David Ripton <[email protected]> wrote: > On 01/29/12 00:57, Fourat ZOUARI wrote: > > > Whenever i try to pass an object (aClass) with a property with a second > > object (bClass) Am getting: > > > > *Unpersistable('Unpersistable data: instance of class amodule.bClass > > deemed insecure')* > > > > > > The aClass is copyable and unjellied, the bClass is not. > > > > Here's my code: > > > > server.py: > > > > from twisted.application import internet, service > > from twisted.spread import pb > > from amodule import PBServer > > > > application = service.Application("Test app") > > > > # Prepare managers > > clientManager = internet.TCPServer(8282, > > pb.PBServerFactory(PBServer())); > > clientManager.setServiceParent(application) > > > > if __name__ == '__main__': > > print "Run with twistd" > > import sys > > sys.exit(1) > > > > > > amodule.py: > > > > from twisted.spread import pb > > > > class bClass: > > """This is not a Copyable class > > """ > > > > class aClass(pb.RemoteCopy, pb.Copyable): > > b = bClass() > > pb.setUnjellyableForClass(aClass, aClass) > > > > class PBServer(pb.Root): > > def remote_echo(self, a): > > return a.b > > > > Is there anyway to unjelly aClass and all the objects it can contain ? > > because unjellying included object is a headache and may turn into dirty > > code ... > > If you make bClass inherit from pb.Copyable and do > pb.setUnjellyableForClass(bClass, bClass) then everything should work. > > Twisted knows how to do what you want, but it's refusing to do because > you haven't marked bClass as safe to pass over the wire. > > -- > David Ripton [email protected] > > _______________________________________________ > Twisted-Python mailing list > [email protected] > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python >
_______________________________________________ Twisted-Python mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
