From 65af0592d339e0d40ed9a688627feb91b020baae Mon Sep 17 00:00:00 2001 From: Unrud Date: Fri, 5 Aug 2016 16:58:03 +0200 Subject: [PATCH] Run hook while storage is still locked --- radicale/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/radicale/__init__.py b/radicale/__init__.py index 0326f7f..340280c 100644 --- a/radicale/__init__.py +++ b/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."""