diff --git a/ldapcherry/__init__.py b/ldapcherry/__init__.py index 642ee2f..d058d80 100644 --- a/ldapcherry/__init__.py +++ b/ldapcherry/__init__.py @@ -149,10 +149,10 @@ class LdapCherry(object): backends = self.backends_params.keys() for b in self.roles.get_backends(): if b not in backends: - raise MissingBackend(b) - for b in self.roles.get_backends(): + raise MissingBackend(b, 'role') + for b in self.attributes.get_backends(): if b not in backends: - raise MissingBackend(b) + raise MissingBackend(b, 'attribute') def _init_backends(self, config): """ Init all backends @@ -1003,7 +1003,7 @@ class LdapCherry(object): def checkppolicy(self, **params): """ search user page """ self._check_auth(must_admin=False, redir_login=False) - keys = params.keys() + keys = list(params.keys()) if len(keys) != 1: cherrypy.response.status = 400 return "bad argument" diff --git a/ldapcherry/exceptions.py b/ldapcherry/exceptions.py index 0bd39b5..cb3ac54 100644 --- a/ldapcherry/exceptions.py +++ b/ldapcherry/exceptions.py @@ -46,11 +46,12 @@ class MissingRole(Exception): class MissingBackend(Exception): - def __init__(self, backend): + def __init__(self, backend, type_conf): self.backend = backend self.log = \ - "backend '%(backend)s' does not exist in main config file" % \ - {'backend': backend} + "backend '%(backend)s' does not exist in main config file " \ + "but is still declared in '%(type_conf)s' file" % \ + {'backend': backend, 'type_conf': type_conf} class WrongBackend(Exception):