mirror of
https://github.com/Kozea/Radicale.git
synced 2025-06-26 16:45:52 +00:00
move check predefined_collections props to config.py
This commit is contained in:
parent
f7e01d55ed
commit
515afb52ed
2 changed files with 7 additions and 4 deletions
|
@ -48,7 +48,6 @@ from radicale.app.propfind import ApplicationPartPropfind
|
|||
from radicale.app.proppatch import ApplicationPartProppatch
|
||||
from radicale.app.put import ApplicationPartPut
|
||||
from radicale.app.report import ApplicationPartReport
|
||||
from radicale.item import check_and_sanitize_props
|
||||
from radicale.log import logger
|
||||
|
||||
# Combination of types.WSGIStartResponse and WSGI application return value
|
||||
|
@ -274,8 +273,7 @@ class Application(ApplicationPartDelete, ApplicationPartHead,
|
|||
jsn_coll = self.configuration.get("storage", "predefined_collections")
|
||||
for (name_coll, props) in jsn_coll.items():
|
||||
try:
|
||||
checked_props = check_and_sanitize_props(props)
|
||||
self._storage.create_collection(principal_path + name_coll, props=checked_props)
|
||||
self._storage.create_collection(principal_path + name_coll, props=props)
|
||||
except ValueError as e:
|
||||
logger.warning("Failed to create predefined collection %r: %s", name_coll, e)
|
||||
except ValueError as e:
|
||||
|
|
|
@ -37,6 +37,7 @@ from typing import (Any, Callable, ClassVar, Iterable, List, Optional,
|
|||
Sequence, Tuple, TypeVar, Union)
|
||||
|
||||
from radicale import auth, hook, rights, storage, types, web
|
||||
from radicale.item import check_and_sanitize_props
|
||||
|
||||
DEFAULT_CONFIG_PATH: str = os.pathsep.join([
|
||||
"?/etc/radicale/config",
|
||||
|
@ -105,7 +106,11 @@ def _convert_to_bool(value: Any) -> bool:
|
|||
def json_str(value: Any) -> dict:
|
||||
if not value:
|
||||
return {}
|
||||
return json.loads(value)
|
||||
ret = json.loads(value)
|
||||
for (name_coll, props) in ret.items():
|
||||
checked_props = check_and_sanitize_props(props)
|
||||
ret[name_coll] = checked_props
|
||||
return ret
|
||||
|
||||
|
||||
INTERNAL_OPTIONS: Sequence[str] = ("_allow_extra",)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue