Cosmetics.
authorDaira Hopwood <daira@jacaranda.org>
Mon, 8 Jun 2015 13:23:30 +0000 (14:23 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Wed, 30 Sep 2015 15:45:21 +0000 (16:45 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/drop_upload.py
src/allmydata/test/test_drop_upload.py

index e5523ff9f94a9f3e06be1ae760bfb235c0db7985..723e0e835044f4db230d526fee7031d9c60c0f93 100644 (file)
@@ -27,7 +27,7 @@ def get_inotify_module():
             from twisted.internet import inotify
         else:
             raise NotImplementedError("filesystem notification needed for drop-upload is not supported.\n"
-                              "This currently requires Linux or Windows.")
+                                      "This currently requires Linux or Windows.")
         return inotify
     except (ImportError, AttributeError) as e:
         log.msg(e)
@@ -90,10 +90,14 @@ class DropUploader(service.MultiService):
         # We don't watch for IN_CREATE, because that would cause us to read and upload a
         # possibly-incomplete file before the application has closed it. There should always
         # be an IN_CLOSE_WRITE after an IN_CREATE (I think).
-        # TODO: what about IN_MOVE_SELF or IN_UNMOUNT?
-        #self.mask = inotify.IN_CLOSE_WRITE | inotify.IN_MOVED_TO | inotify.IN_ONLYDIR
-        #self.mask = inotify.IN_CLOSE_WRITE | inotify.IN_MOVED_TO | inotify.IN_MOVED_FROM | inotify.IN_ONLYDIR | IN_EXCL_UNLINK
-        self.mask = inotify.IN_CLOSE_WRITE | inotify.IN_MOVED_TO | inotify.IN_ONLYDIR | IN_EXCL_UNLINK | inotify.IN_DELETE
+        # TODO: what about IN_MOVE_SELF, IN_MOVED_FROM, or IN_UNMOUNT?
+        #
+        self.mask = ( inotify.IN_CLOSE_WRITE
+                    | inotify.IN_MOVED_TO
+                    | inotify.IN_DELETE
+                    | inotify.IN_ONLYDIR
+                    | IN_EXCL_UNLINK
+                    )
         self._notifier.watch(self._local_path, mask=self.mask, callbacks=[self._notify],
                              recursive=True)
 
index e6dab77c093848e51c858baf2533d18752cf03aa..5c19995dfdb99587ab54fac81ddf5546bba6bd03 100644 (file)
@@ -275,7 +275,7 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, NonA
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.directories_created'), 1))
         d.addBoth(self._cleanup)
         return d
-        
+
     def test_drop_upload(self):
         self.set_up_grid()
         self.local_dir = os.path.join(self.basedir, self.unicode_or_fallback(u"loc\u0101l_dir", u"local_dir"))