[svn r38040] My favorite lazy-lexical-scope-binding error. Still thinking how to make test

for that. Basically - callbacks with lexical scope variables are usually
(depends of coz) called with variables after the for loop has finished.

--HG--
branch : trunk
This commit is contained in:
fijal 2007-02-07 00:13:50 +01:00
parent 3fa9cbe98d
commit b91e13d5df
1 changed files with 3 additions and 2 deletions

View File

@ -133,10 +133,11 @@ class HostManager(object):
verbose=self.config.option.verbose)
destrelpath = root.relto(self.config.topdir)
for host in self.hosts:
def donecallback():
def donecallback(host, root):
reporter(repevent.HostRSyncRootReady(host, root))
remotepath = rsync.add_target_host(
host, reporter, destrelpath, finishedcallback=donecallback)
host, reporter, destrelpath, finishedcallback=
lambda host=host, root=root: donecallback(host, root))
reporter(repevent.HostRSyncing(host, root, remotepath))
rsync.send(root)