From: Daira Hopwood Date: Tue, 11 Aug 2015 14:09:56 +0000 (+0100) Subject: Refactor uploader by inlining _add_file into _process._maybe_upload. X-Git-Url: https://git.rkrishnan.org/%3C?a=commitdiff_plain;h=b637effafa93ca20e803166aa801ea46527df034;p=tahoe-lafs%2Ftahoe-lafs.git Refactor uploader by inlining _add_file into _process._maybe_upload. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index abeaf6ea..f4f69ee8 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -287,10 +287,6 @@ class Uploader(QueueMixin): precondition(isinstance(path_u, unicode), path_u) d = defer.succeed(None) - def _add_file(encoded_name_u, version): - uploadable = FileName(path_u, self._client.convergence) - return self._upload_dirnode.add_file(encoded_name_u, uploadable, metadata={"version":version}, overwrite=True) - def _add_dir(encoded_name_u): self._notifier.watch(to_filepath(path_u), mask=self.mask, callbacks=[self._notify], recursive=True) uploadable = Data("", self._client.convergence) @@ -362,7 +358,9 @@ class Uploader(QueueMixin): version = 0 else: version += 1 - d2 = _add_file(encoded_name_u, version) + + uploadable = FileName(path_u, self._client.convergence) + d2 = self._upload_dirnode.add_file(encoded_name_u, uploadable, metadata={"version":version}, overwrite=True) def add_db_entry(filenode): filecap = filenode.get_uri() s = os.stat(path_u)