Browse Source

Merge pull request #460 from Unrud/patch-25

Run hook while storage is still locked
Guillaume Ayoub 9 năm trước cách đây
mục cha
commit
7703008d8f
1 tập tin đã thay đổi với 8 bổ sung8 xóa
  1. 8 8
      radicale/__init__.py

+ 8 - 8
radicale/__init__.py

@@ -372,14 +372,14 @@ class Application:
         """Lock the collection with ``permission`` and execute hook."""
         with self.Collection.acquire_lock(lock_mode) as value:
             yield value
-        hook = self.configuration.get("storage", "hook")
-        if lock_mode == "w" and hook:
-            self.logger.debug("Running hook")
-            folder = os.path.expanduser(self.configuration.get(
-                "storage", "filesystem_folder"))
-            subprocess.check_call(
-                hook % {"user": shlex.quote(user or "Anonymous")},
-                shell=True, cwd=folder)
+            hook = self.configuration.get("storage", "hook")
+            if lock_mode == "w" and hook:
+                self.logger.debug("Running hook")
+                folder = os.path.expanduser(self.configuration.get(
+                    "storage", "filesystem_folder"))
+                subprocess.check_call(
+                    hook % {"user": shlex.quote(user or "Anonymous")},
+                    shell=True, cwd=folder)
 
     def do_DELETE(self, environ, path, content, user):
         """Manage DELETE request."""