Rename loader to load_plugin

This commit is contained in:
Unrud 2020-01-15 00:32:36 +01:00
parent a8a1fc470b
commit 0cd95f8a39
5 changed files with 6 additions and 5 deletions

View File

@ -35,7 +35,7 @@ INTERNAL_TYPES = ("none", "remote_user", "http_x_remote_user", "htpasswd")
def load(configuration):
"""Load the authentication module chosen in configuration."""
return utils.loader(INTERNAL_TYPES, "auth", "Auth", configuration)
return utils.load_plugin(INTERNAL_TYPES, "auth", "Auth", configuration)
class BaseAuth:

View File

@ -37,7 +37,7 @@ INTERNAL_TYPES = ("authenticated", "owner_write", "owner_only", "from_file")
def load(configuration):
"""Load the rights module chosen in configuration."""
return utils.loader(INTERNAL_TYPES, "rights", "Rights", configuration)
return utils.load_plugin(INTERNAL_TYPES, "rights", "Rights", configuration)
def intersect_permissions(a, b="RrWw"):

View File

@ -42,7 +42,8 @@ CACHE_VERSION = (";".join(pkg_resources.get_distribution(pkg).version
def load(configuration):
"""Load the storage module chosen in configuration."""
return utils.loader(INTERNAL_TYPES, "storage", "Storage", configuration)
return utils.load_plugin(
INTERNAL_TYPES, "storage", "Storage", configuration)
class ComponentExistsError(ValueError):

View File

@ -21,7 +21,7 @@ from importlib import import_module
from radicale.log import logger
def loader(internal_types, module_name, class_name, configuration):
def load_plugin(internal_types, module_name, class_name, configuration):
type_ = configuration.get(module_name, "type")
if type_ in internal_types:
module = "radicale.%s.%s" % (module_name, type_)

View File

@ -28,7 +28,7 @@ INTERNAL_TYPES = ("none", "internal")
def load(configuration):
"""Load the web module chosen in configuration."""
return utils.loader(INTERNAL_TYPES, "web", "Web", configuration)
return utils.load_plugin(INTERNAL_TYPES, "web", "Web", configuration)
class BaseWeb: