[svn r38174] Flag instead of new method and a test.

--HG--
branch : trunk
This commit is contained in:
fijal
2007-02-08 17:01:51 +01:00
parent 27cf3997e3
commit e3dce2c288
2 changed files with 10 additions and 10 deletions

View File

@@ -93,19 +93,16 @@ class RSync(object):
if self._verbose:
print '%s <= %s' % (gateway.remoteaddress, modified_rel_path)
def send_if_targets(self):
""" Sends only if there are targets, otherwise returns
def send(self, raises=True):
""" Sends a sourcedir to all added targets. Flag indicates
whether to raise an error or return in case of lack of
targets
"""
if not self._channels:
if raises:
raise IOError("no targets available, maybe you "
"are trying call send() twice?")
return
self.send()
def send(self):
""" Sends a sourcedir to all added targets.
"""
if not self._channels:
raise IOError("no targets available, maybe you "
"are trying call send() twice?")
# normalize a trailing '/' away
self._sourcedir = os.path.dirname(os.path.join(self._sourcedir, 'x'))
# send directory structure and file timestamps/sizes