[Twisted-Python] Transparent Remote Objects

Glyph Lefkowitz glyph at twistedmatrix.com
Fri May 16 14:04:37 EDT 2003

On Friday, May 16, 2003, at 10:23 AM, Justin Johnson wrote:

> Adding callbacks to Deffereds looks a little cumbersome and makes it 
> harder to read the code.  Is there a way to make this more > transparent?

Transparency is not a goal of PB.

It does sound like you don't really need many callbacks though: your 
example code could be something like:

o = remoteThingy.getMeAVobContainer().addCallback(gotMeAVobContainer)

class RemoteVOB:
     def __init__(self, vc, tag, site):
         self.vc = vc
         self.tag = tag
         self.site = site

     def make(self):
         return self.vc.callRemote("makeVOB", self.tag, self.site)
     def export(self, s):
         return self.vc.callRemote("exportVOB", self.tag, self.site, s)
     def import(self):
         return self.vc.callRemote("importVOB", self.tag, self.site)

def gotMeAVobContainer(vc):
     for tag in vobs:
         v = RemoteVOB(vc, tag, start_site)
         for s in sites:
             rv = RemoteVOB(tag, s)

Does that explain anything?

More information about the Twisted-Python mailing list