diff --git a/bigchaindb/backend/rethinkdb/query.py b/bigchaindb/backend/rethinkdb/query.py index 6950d0d1..f0096f93 100644 --- a/bigchaindb/backend/rethinkdb/query.py +++ b/bigchaindb/backend/rethinkdb/query.py @@ -6,14 +6,14 @@ import rethinkdb as r from bigchaindb import backend, util from bigchaindb.common import exceptions -from bigchaindb.backend.utils import make_module_dispatch_registrar +from bigchaindb.backend.utils import module_dispatch_registrar from bigchaindb.backend.rethinkdb.connection import RethinkDBConnection READ_MODE = 'majority' WRITE_DURABILITY = 'hard' -register_query = make_module_dispatch_registrar(backend.query) +register_query = module_dispatch_registrar(backend.query) @register_query(RethinkDBConnection) diff --git a/bigchaindb/backend/rethinkdb/schema.py b/bigchaindb/backend/rethinkdb/schema.py index 97d25161..616ef71d 100644 --- a/bigchaindb/backend/rethinkdb/schema.py +++ b/bigchaindb/backend/rethinkdb/schema.py @@ -6,12 +6,12 @@ import rethinkdb as r from bigchaindb import backend from bigchaindb.common import exceptions -from bigchaindb.backend.utils import make_module_dispatch_registrar +from bigchaindb.backend.utils import module_dispatch_registrar from bigchaindb.backend.rethinkdb.connection import RethinkDBConnection logger = logging.getLogger(__name__) -register_schema = make_module_dispatch_registrar(backend.schema) +register_schema = module_dispatch_registrar(backend.schema) @register_schema(RethinkDBConnection) diff --git a/bigchaindb/backend/utils.py b/bigchaindb/backend/utils.py index c30f7b53..23b3e2d9 100644 --- a/bigchaindb/backend/utils.py +++ b/bigchaindb/backend/utils.py @@ -1,9 +1,9 @@ -class BackendModuleDispatchRegisterError(Exception): +class ModuleDispatchRegistrationError(Exception): """Raised when there is a problem registering dispatched functions for a - backend module""" + module""" -def make_module_dispatch_registrar(module): +def module_dispatch_registrar(module): def dispatch_wrapper(obj_type): def wrapper(func): func_name = func.__name__ @@ -11,10 +11,10 @@ def make_module_dispatch_registrar(module): dispatch_registrar = getattr(module, func_name) return dispatch_registrar.register(obj_type)(func) except AttributeError as ex: - raise BackendModuleDispatchRegisterError( - ("'{module}' does not contain a single-dispatchable " - "function named '{func}'. The backend being used has not " - "been implemented correctly!").format( + raise ModuleDispatchRegistrationError( + ("`{module}` does not contain a single-dispatchable " + "function named `{func}`. The module being registered " + "was not implemented correctly!").format( func=func_name, module=module.__name__)) from ex return wrapper return dispatch_wrapper