[py-svn] r36447 - py/dist/py/test/rsession
hpk at codespeak.net
hpk at codespeak.net
Thu Jan 11 08:03:51 CET 2007
Author: hpk
Date: Thu Jan 11 08:03:49 2007
New Revision: 36447
Modified:
py/dist/py/test/rsession/rsync.py
Log:
added some comments to fijals progress-callback addition
(not sure introducing callbacks here is worth it and
may not have bad side effects such as keeping channels alive
longer than neccessary).
Modified: py/dist/py/test/rsession/rsync.py
==============================================================================
--- py/dist/py/test/rsession/rsync.py (original)
+++ py/dist/py/test/rsession/rsync.py Thu Jan 11 08:03:49 2007
@@ -30,8 +30,12 @@
self.sourcedir = os.path.dirname(os.path.join(self.sourcedir, 'x'))
# send directory structure and file timestamps/sizes
self._send_directory_structure(self.sourcedir)
+
+ # paths and to_send are only used for doing
+ # progress-related callbacks
self.paths = {}
self.to_send = {}
+
# send modified file to clients
while self.channels:
channel, req = self.receivequeue.get()
@@ -67,11 +71,14 @@
modifiedpath = os.path.join(self.sourcedir, *modified_rel_path)
f = open(modifiedpath, 'rb')
data = f.read()
+
+ # provide info to progress callback function
modified_rel_path = "/".join(modified_rel_path)
self.paths[modified_rel_path] = len(data)
if channel not in self.to_send:
self.to_send[channel] = []
self.to_send[channel].append(modified_rel_path)
+
f.close()
if checksum is not None and checksum == md5.md5(data).digest():
data = None # not really modified
More information about the py-svn
mailing list