mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-13 18:50:53 +00:00
add support for placeholders 'request' and 'to_path'
This commit is contained in:
parent
cdfee329db
commit
eec7d5bbbf
1 changed files with 6 additions and 0 deletions
|
@ -78,10 +78,16 @@ class StoragePartLock(StorageBase):
|
||||||
preexec_fn = os.setpgrp
|
preexec_fn = os.setpgrp
|
||||||
# optional argument
|
# optional argument
|
||||||
path = kwargs.get('path', "")
|
path = kwargs.get('path', "")
|
||||||
|
request = kwargs.get('request', "NONE")
|
||||||
|
to_path = kwargs.get('to_path', "")
|
||||||
|
if to_path != "":
|
||||||
|
to_path = shlex.quote(self._get_collection_root_folder() + to_path)
|
||||||
try:
|
try:
|
||||||
command = self._hook % {
|
command = self._hook % {
|
||||||
"path": shlex.quote(self._get_collection_root_folder() + path),
|
"path": shlex.quote(self._get_collection_root_folder() + path),
|
||||||
|
"to_path": to_path,
|
||||||
"cwd": shlex.quote(self._filesystem_folder),
|
"cwd": shlex.quote(self._filesystem_folder),
|
||||||
|
"request": shlex.quote(request),
|
||||||
"user": shlex.quote(user or "Anonymous")}
|
"user": shlex.quote(user or "Anonymous")}
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
logger.error("Storage hook contains not supported placeholder %s (skip execution of: %r)" % (e, self._hook))
|
logger.error("Storage hook contains not supported placeholder %s (skip execution of: %r)" % (e, self._hook))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue