1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-26 03:04:30 +01:00

pep8 compliance on ldapcherry/exceptions.py

This commit is contained in:
kakwa 2015-07-11 09:05:01 +02:00
parent 24aabe2908
commit f29039704e

View File

@ -12,7 +12,9 @@ class MissingParameter(Exception):
def __init__(self, section, key): def __init__(self, section, key):
self.section = section self.section = section
self.key = key self.key = key
self.log = "missing parameter '%(key)s' in section '%(section)s'" % {'key': key, 'section': section} self.log = \
"missing parameter '%(key)s' in section '%(section)s'" % \
{'key': key, 'section': section}
class MissingKey(Exception): class MissingKey(Exception):
@ -20,68 +22,91 @@ class MissingKey(Exception):
self.key = key self.key = key
self.section = section self.section = section
self.ymlfile = ymlfile self.ymlfile = ymlfile
self.log = "missing key '%(key)s' in section '%(section)s' inside file '%(ymlfile)s'" % {'key': key, 'section': section, 'ymlfile': ymlfile} self.log = \
"missing key '%(key)s' in section '%(section)s'" \
" inside file '%(ymlfile)s'" % \
{'key': key, 'section': section, 'ymlfile': ymlfile}
class DumplicateRoleKey(Exception): class DumplicateRoleKey(Exception):
def __init__(self, role): def __init__(self, role):
self.role = role self.role = role
self.log = "duplicate role key '%(role)s' in role file" % {'role': role} self.log = \
"duplicate role key '%(role)s' in role file" % \
{'role': role}
class MissingRole(Exception): class MissingRole(Exception):
def __init__(self, role): def __init__(self, role):
self.role = role self.role = role
self.log = "role '%(role)s' does not exist in role file" % {'role': role} self.log = \
"role '%(role)s' does not exist in role file" % \
{'role': role}
class MissingBackend(Exception): class MissingBackend(Exception):
def __init__(self, backend): def __init__(self, backend):
self.backend = backend self.backend = backend
self.log = "backend '%(backend)s' does not exist in main config file" % {'backend': backend} self.log = \
"backend '%(backend)s' does not exist in main config file" % \
{'backend': backend}
class WrongBackend(Exception): class WrongBackend(Exception):
def __init__(self, backend): def __init__(self, backend):
self.backend = backend self.backend = backend
self.log = "backend '%(backend)s' does not exist" % {'backend': backend} self.log = \
"backend '%(backend)s' does not exist" % \
{'backend': backend}
class DumplicateRoleContent(Exception): class DumplicateRoleContent(Exception):
def __init__(self, role1, role2): def __init__(self, role1, role2):
self.role1 = role1 self.role1 = role1
self.role2 = role2 self.role2 = role2
self.log = "role '%(role1)s' and '%(role2)s' are identical" % {'role1': role1, 'role2': role2} self.log = \
"role '%(role1)s' and '%(role2)s' are identical" % \
{'role1': role1, 'role2': role2}
class MissingRolesFile(Exception): class MissingRolesFile(Exception):
def __init__(self, rolefile): def __init__(self, rolefile):
self.rolefile = rolefile self.rolefile = rolefile
self.log = "fail to open role file '%(rolefile)s'" % {'rolefile': rolefile} self.log = \
"fail to open role file '%(rolefile)s'" % \
{'rolefile': rolefile}
class MissingMainFile(Exception): class MissingMainFile(Exception):
def __init__(self, config): def __init__(self, config):
self.rolefile = rolefile self.rolefile = rolefile
self.log = "fail to open main file '%(config)s'" % {'rolefile': rolefile} self.log = \
"fail to open main file '%(config)s'" % \
{'rolefile': rolefile}
class MissingAttributesFile(Exception): class MissingAttributesFile(Exception):
def __init__(self, attributesfile): def __init__(self, attributesfile):
self.attributesfile = attributesfile self.attributesfile = attributesfile
self.log = "fail to open attributes file '%(attributesfile)s'" % {'attributesfile': attributesfile} self.log = \
"fail to open attributes file '%(attributesfile)s'" % \
{'attributesfile': attributesfile}
class BackendModuleLoadingFail(Exception): class BackendModuleLoadingFail(Exception):
def __init__(self, module): def __init__(self, module):
self.module = module self.module = module
self.log = "module '%(module)s' not in python path" % {'module': module} self.log = \
"module '%(module)s' not in python path" % \
{'module': module}
class BackendModuleInitFail(Exception): class BackendModuleInitFail(Exception):
def __init__(self, module): def __init__(self, module):
self.module = module self.module = module
self.log = "fail to init module '%(module)s'" % {'module': module} self.log = \
"fail to init module '%(module)s'" % \
{'module': module}
class WrongParamValue(Exception): class WrongParamValue(Exception):
@ -90,14 +115,23 @@ class WrongParamValue(Exception):
self.section = section self.section = section
self.param = param self.param = param
possible_values_str = string.join(possible_values, ', ') possible_values_str = string.join(possible_values, ', ')
self.log = "wrong value for param '%(param)s' in section '%(section)s', possible values are [%(values)s]" % {'param': param, 'section': section, 'values': possible_values_str} self.log = \
"wrong value for param '%(param)s' in section '%(section)s'"\
", possible values are [%(values)s]" % \
{
'param': param,
'section': section,
'values': possible_values_str
}
class DumplicateUserKey(Exception): class DumplicateUserKey(Exception):
def __init__(self, attrid1, attrid2): def __init__(self, attrid1, attrid2):
self.attrid1 = attrid1 self.attrid1 = attrid1
self.attrid2 = attrid2 self.attrid2 = attrid2
self.log = "duplicate key in '%(attrid1)s' and '%(attrid2)s'" % {'attrid1': attrid1, 'attrid2': attrid2} self.log = \
"duplicate key in '%(attrid1)s' and '%(attrid2)s'" % \
{'attrid1': attrid1, 'attrid2': attrid2}
class MissingUserKey(Exception): class MissingUserKey(Exception):
@ -110,4 +144,8 @@ class WrongAttributeType(Exception):
self.key = key self.key = key
self.section = section self.section = section
self.ymlfile = ymlfile self.ymlfile = ymlfile
self.log = "wrong attribute type '%(key)s' in section '%(section)s' inside file '%(ymlfile)s'" % {'key': key, 'section': section, 'ymlfile': ymlfile} self.log = \
"wrong attribute type '%(key)s'" \
" in section '%(section)s'" \
" inside file '%(ymlfile)s'" % \
{'key': key, 'section': section, 'ymlfile': ymlfile}