[Twisted-Python] Intra-process callRemote

Kevin Turner acapnotic at twistedmatrix.com
Tue Apr 30 13:05:33 EDT 2002

I've got an arrangement where the obvious way to do things is with a

class StorageThing(pb.Viewable):
    def view_setMessage(self, who, what):
        self._store[who.identityName] = what

class Who(pb.Perspective):
    def setMyMessage(self, what):
        self.storageView.callRemote("setMessage", what)

only, it turns out that some of the "who"s don't really need to be in a
seperate process from the Viewable; storageView is actually a reference
to a ViewPoint instead of a *remote* reference to a ViewPoint, and
ViewPoints don't have callRemote (because, well, they're not remote).

I don't know, maybe PB just isn't quite as transparent as I desire it to
be.  I did so much like the idea of writing this code to communicate
locally now, and just being able to drop in remote objects instead

I could of course do

    def setMyMessage(self, what):
        self.storageView.view_setMessage(self, what)

but that doesn't look nearly as elegant, and I'll have to make duplicate
code with a callRemote if storageView ever becomes remote.


 - Kevin

The moon is waning gibbous, 86.0% illuminated, 18.4 days old.

More information about the Twisted-Python mailing list