1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-12 04:28:51 +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:
raise BackendModuleLoadingFail(module)
try:
self.backends[backend] = bc.Backend(params, cherrypy.log)
self.backends[backend] = bc.Backend(params, cherrypy.log, backend)
except:
raise BackendModuleInitFail(module)

View File

@ -5,6 +5,8 @@
# LdapCherry
# Copyright (c) 2014 Carpentier Pierre-Francois
from ldapcherry.exceptions import MissingParameter
class Backend:
def __init__(self):
@ -21,3 +23,12 @@ class Backend:
def rm_from_group(self):
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):
def __init__(self, config, logger):
def __init__(self, config, logger, name):
pass