Allow attach custom storage backend
This commit is contained in:
@ -23,15 +23,20 @@ This module loads the storage backend, according to the storage
|
||||
configuration.
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
from .. import config, ical
|
||||
|
||||
|
||||
def load():
|
||||
"""Load list of available storage managers."""
|
||||
storage_type = config.get("storage", "type")
|
||||
root_module = __import__(
|
||||
"storage.%s" % storage_type, globals=globals(), level=2)
|
||||
module = getattr(root_module, storage_type)
|
||||
if storage_type == "custom":
|
||||
storage_module = config.get("storage", "custom_handler")
|
||||
__import__(storage_module)
|
||||
module = sys.modules[storage_module]
|
||||
else:
|
||||
root_module = __import__(
|
||||
"storage.%s" % storage_type, globals=globals(), level=2)
|
||||
module = getattr(root_module, storage_type)
|
||||
ical.Collection = module.Collection
|
||||
return module
|
||||
|
Reference in New Issue
Block a user