
On Friday 29 July 2005 10:46, Stephan Popp wrote:
Hi, I want to send objects accross the network and all I get is insecure Jelly. My application looks like this: -folder structure: -dispyte --common --GACrysVUn --baseclasses
in common is the declaration of the object which should be send:
from dispyte.baseclasses import Task #thats the abstract baseclass from twisted.spread import pb
class SimpleTask(Task.Task, pb.Copyable, pb.RemoteCopy): def __init__(self): ...
pb.setUnjellyableForClass(SimpleTask, SimpleTask)
these objects are created by a instance of a class located in GACrysVUn:
from dispyte.baseclasses import Producer from dispyte.common import SimpleTask
class GACrysVUnProducer(Producer.Producer):
def foo(): #just as examlpe of the structure task = SimpleTask.SimpleTask()
the task-object is given to another class instance lockated in common: here the task object is send:
... factory = pb.PBClientFactory() reactor.connectTCP(parameters[0], parameters[1], factory) def0 = factory.getRootObject() ... def2 = self.root.callRemote("fitness", task, self.taskDescription, self.ID) def2.addCallback(self.callback) def2.addErrback(self.errback, task, self)
the server looks like:
from twisted.spread import pb from twisted.internet import reactor,threads from dispyte.common import SimpleTask from dispyte.common import ScriptedTaskDescription import sys class ServerObject(pb.Root):
...
def remote_fitness(self, task, taskDescription, serverID): """ calls calc in seperate thread and return a deferred """ self.ID = serverID print "ServerObject::remote_fitness ..." return threads.deferToThread(self.calc,task,serverID, taskDescription)
...
if __name__ == '__main__': factory = pb.PBServerFactory(ServerObject(sys.argv[1])) reactor.listenTCP(eval(sys.argv[1]), factory) reactor.run()
I can't figure out, why insecureJelly is raised here. Can anyone help me? And: Is there a possibility to turn off this feature, so that a server takes objects no matter what class?
Thanks in advance.
Stephan
PS: the error message is (from failue.getErrorMessage()): Module dispyte.common.SimpleTask not allowed (in type dispyte.common.SimpleTask.SimpleTask)