Make sure that the root collection exists.

Since the collections are not directly in **filesystem_path** anymore,
the folder is not created by ``Collection.acquire_lock``.
This commit is contained in:
Unrud 2016-08-05 17:19:57 +02:00
parent 05a4285f54
commit 6c3e59fd11

View File

@ -262,6 +262,8 @@ class BaseCollection:
The ``path`` is relative. The ``path`` is relative.
The root collection "/" must always exist.
""" """
raise NotImplementedError raise NotImplementedError
@ -433,6 +435,8 @@ class Collection(BaseCollection):
# Try to guess if the path leads to a collection or an item # Try to guess if the path leads to a collection or an item
folder = cls._get_collection_root_folder() folder = cls._get_collection_root_folder()
# Create the root collection
cls._makedirs_synced(folder, exist_ok=True)
try: try:
filesystem_path = path_to_filesystem(folder, sane_path) filesystem_path = path_to_filesystem(folder, sane_path)
except ValueError: except ValueError: