From 7342ddac2969a7888036bf9a8d245f7dfb4c9c75 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Mon, 20 Apr 2015 17:52:48 +0100 Subject: [PATCH] Clarify dir/file/link logic. Signed-off-by: Daira Hopwood --- src/allmydata/frontends/drop_upload.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/allmydata/frontends/drop_upload.py b/src/allmydata/frontends/drop_upload.py index 9c2efbae..f2016f69 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) -- 2.45.2