[Twisted-Python] Transparent Remote Objects
Glyph Lefkowitz
glyph at twistedmatrix.com
Fri May 16 12:04:37 MDT 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)
v.make()
for s in sites:
v.export(s)
rv = RemoteVOB(tag, s)
rv.import()
Does that explain anything?
More information about the Twisted-Python
mailing list