1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 09:24:21 +01:00

adding a get_param method + pass backend name to backend

This commit is contained in:
kakwa 2015-05-21 19:54:38 +02:00
parent a8c61d33e6
commit 3ab1cbcdb2
3 changed files with 13 additions and 2 deletions

View File

@ -107,7 +107,7 @@ class LdapCherry(object):
except: except:
raise BackendModuleLoadingFail(module) raise BackendModuleLoadingFail(module)
try: try:
self.backends[backend] = bc.Backend(params, cherrypy.log) self.backends[backend] = bc.Backend(params, cherrypy.log, backend)
except: except:
raise BackendModuleInitFail(module) raise BackendModuleInitFail(module)

View File

@ -5,6 +5,8 @@
# LdapCherry # LdapCherry
# Copyright (c) 2014 Carpentier Pierre-Francois # Copyright (c) 2014 Carpentier Pierre-Francois
from ldapcherry.exceptions import MissingParameter
class Backend: class Backend:
def __init__(self): def __init__(self):
@ -21,3 +23,12 @@ class Backend:
def rm_from_group(self): def rm_from_group(self):
pass pass
def get_param(self, param, default=False):
if param in self.config:
return self.config[param]
elif default:
return default
else:
raise MissingParameter(self.backend_name+'.'+param, 'backends')

View File

@ -9,5 +9,5 @@ import ldapcherry.backend
class Backend(ldapcherry.backend.Backend): class Backend(ldapcherry.backend.Backend):
def __init__(self, config, logger): def __init__(self, config, logger, name):
pass pass