Use the same import mechanisms for auth, storage, rights

This commit is contained in:
Guillaume Ayoub
2012-08-09 15:39:01 +02:00
parent 3ddbb80674
commit 17857654b0
7 changed files with 113 additions and 134 deletions

View File

@ -24,12 +24,14 @@ configuration.
"""
from radicale import config
from radicale import config, ical
def load():
"""Load list of available storage managers."""
storage_type = config.get("storage", "type")
module = __import__(
root_module = __import__(
"storage.%s" % storage_type, globals=globals(), level=2)
return getattr(module, storage_type)
module = getattr(root_module, storage_type)
ical.Collection = module.Collection
return module

View File

@ -112,6 +112,3 @@ class Collection(ical.Collection):
self._create_dirs()
with open(self._props_path, "w") as prop_file:
json.dump(properties, prop_file)
ical.Collection = Collection