[Twisted-Python] Copyable.getStateToCopyFor 'perspective' argument is None

Ralf Schmitt ralf at brainbot.com
Sun Mar 21 18:08:49 MST 2004


Hi,

the following program uses Copyable's getStateToCopyFor method but
only get's passed a 'None perspective'. Am I doing something wrong or
is this a bug?

- Ralf



#! /usr/bin/env python

from twisted.spread import pb, flavors
from twisted.internet import reactor


class Foo(flavors.Copyable, flavors.RemoteCopy):
    def getStateToCopyFor(self, perspective):
        print "PERSPECTIVE:", perspective
        return self.__dict__    

pb.setUnjellyableForClass(Foo, Foo)

class Echoer(pb.Root):
    def remote_echo(self, st):
        print 'echoing:', st
        #return st
    
factory = pb.PBClientFactory()
reactor.connectTCP("localhost", 8789, factory)
d = factory.getRootObject()
d.addCallback(lambda object: object.callRemote("echo", Foo()))

reactor.listenTCP(8789, pb.PBServerFactory(Echoer()))
reactor.run()

-- 
brainbot technologies ag
boppstrasse 64 . 55118 mainz . germany
fon +49 6131 211639-1 . fax +49 6131 211639-2
http://brainbot.com/  mailto:ralf at brainbot.com




More information about the Twisted-Python mailing list