From: Daira Hopwood Date: Mon, 20 Apr 2015 16:52:48 +0000 (+0100) Subject: Clarify dir/file/link logic. X-Git-Url: https://git.rkrishnan.org/pf/content/quickstart.html?a=commitdiff_plain;h=1fc4bdd2d0ff3d546f516305abee03364b433555;p=tahoe-lafs%2Ftahoe-lafs.git Clarify dir/file/link logic. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/frontends/drop_upload.py b/src/allmydata/frontends/drop_upload.py index bdf962c5..f944e6b0 100644 --- a/src/allmydata/frontends/drop_upload.py +++ b/src/allmydata/frontends/drop_upload.py @@ -104,18 +104,21 @@ class DropUploader(service.MultiService): assert isinstance(child, unicode), child childpath = os.path.join(localpath, child) # note: symlinks to directories are both islink() and isdir() - if os.path.isdir(childpath) and not os.path.islink(childpath): + isdir = os.path.isdir(childpath) + isfile = os.path.isfile(childpath) + islink = os.path.islink(childpath) + + if islink: + self.warn("WARNING: cannot backup symlink %s" % quote_local_unicode_path(childpath)) + elif isdir: # recurse on the child directory self._scan(childpath) - elif os.path.isfile(childpath) and not os.path.islink(childpath): + elif isfile: must_upload = self._check_db_file(childpath) if must_upload: self._append_to_deque(childpath) else: - if os.path.islink(childpath): - self.warn("WARNING: cannot backup symlink %s" % quote_local_unicode_path(childpath)) - else: - self.warn("WARNING: cannot backup special file %s" % quote_local_unicode_path(childpath)) + self.warn("WARNING: cannot backup special file %s" % quote_local_unicode_path(childpath)) def startService(self): self._db = backupdb.get_backupdb(self._dbfile)