mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-10 18:40:53 +00:00
Mark attributes for internal use with underscore
This commit is contained in:
parent
9b51e495ea
commit
1453c0b72c
11 changed files with 77 additions and 74 deletions
|
@ -47,8 +47,8 @@ class ApplicationPutMixin:
|
|||
# Prepare before locking
|
||||
parent_path = pathutils.unstrip_path(
|
||||
posixpath.dirname(pathutils.strip_path(path)), True)
|
||||
permissions = self.rights.authorized(user, path, "Ww")
|
||||
parent_permissions = self.rights.authorized(user, parent_path, "w")
|
||||
permissions = self._rights.authorized(user, path, "Ww")
|
||||
parent_permissions = self._rights.authorized(user, parent_path, "w")
|
||||
|
||||
def prepare(vobject_items, tag=None, write_whole_collection=None):
|
||||
if (write_whole_collection or
|
||||
|
@ -149,9 +149,9 @@ class ApplicationPutMixin:
|
|||
(prepared_items, prepared_tag, prepared_write_whole_collection,
|
||||
prepared_props, prepared_exc_info) = prepare(vobject_items)
|
||||
|
||||
with self.storage.acquire_lock("w", user):
|
||||
item = next(self.storage.discover(path), None)
|
||||
parent_item = next(self.storage.discover(parent_path), None)
|
||||
with self._storage.acquire_lock("w", user):
|
||||
item = next(self._storage.discover(path), None)
|
||||
parent_item = next(self._storage.discover(parent_path), None)
|
||||
if not parent_item:
|
||||
return httputils.CONFLICT
|
||||
|
||||
|
@ -165,9 +165,10 @@ class ApplicationPutMixin:
|
|||
tag = parent_item.get_meta("tag")
|
||||
|
||||
if write_whole_collection:
|
||||
if not self.rights.authorized(user, path, "w" if tag else "W"):
|
||||
if not self._rights.authorized(
|
||||
user, path, "w" if tag else "W"):
|
||||
return httputils.NOT_ALLOWED
|
||||
elif not self.rights.authorized(user, parent_path, "w"):
|
||||
elif not self._rights.authorized(user, parent_path, "w"):
|
||||
return httputils.NOT_ALLOWED
|
||||
|
||||
etag = environ.get("HTTP_IF_MATCH", "")
|
||||
|
@ -197,7 +198,7 @@ class ApplicationPutMixin:
|
|||
|
||||
if write_whole_collection:
|
||||
try:
|
||||
etag = self.storage.create_collection(
|
||||
etag = self._storage.create_collection(
|
||||
path, prepared_items, props).etag
|
||||
except ValueError as e:
|
||||
logger.warning(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue