Merge pull request #465 from Unrud/patch-29
Always use wrapper to lock collection
This commit is contained in:
commit
8f05bea8ea
@ -284,12 +284,12 @@ class Application:
|
|||||||
if user and is_authenticated:
|
if user and is_authenticated:
|
||||||
principal_path = "/%s/" % user
|
principal_path = "/%s/" % user
|
||||||
if self.authorized(user, principal_path, "w"):
|
if self.authorized(user, principal_path, "w"):
|
||||||
with self.Collection.acquire_lock("r"):
|
with self._lock_collection("r", user):
|
||||||
principal = next(
|
principal = next(
|
||||||
self.Collection.discover(principal_path, depth="1"),
|
self.Collection.discover(principal_path, depth="1"),
|
||||||
None)
|
None)
|
||||||
if not principal:
|
if not principal:
|
||||||
with self.Collection.acquire_lock("w"):
|
with self._lock_collection("w", user):
|
||||||
self.Collection.create_collection(principal_path)
|
self.Collection.create_collection(principal_path)
|
||||||
|
|
||||||
# Get content
|
# Get content
|
||||||
|
Loading…
Reference in New Issue
Block a user