From c29e92e3b83efb4181e13f6cd97fa1f234e578ef Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Wed, 29 Oct 2014 13:15:44 +0100 Subject: [PATCH] mode debug: tout pointe vers lc_ldap_test --- shortcuts.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/shortcuts.py b/shortcuts.py index f5a8347..eea3ec2 100644 --- a/shortcuts.py +++ b/shortcuts.py @@ -34,6 +34,10 @@ current_user = os.getenv("SUDO_USER") or os.getenv("USER") or os.getenv("LOGNAME if isinstance(current_user, str): current_user = current_user.decode("utf-8") +#: Les racourcis définis plus bas pointent tous vers lc_ldap_test en mode +# debug +DB_TEST_OVERRIDE = bool(os.getenv('DBG_LDAP', False)) + def lc_ldap(*args, **kwargs): """Renvoie une connexion à la base LDAP.""" return module_qui_a_le_meme_nom_que_sa_classe_principale.lc_ldap(*args, **kwargs) @@ -113,6 +117,12 @@ def lc_ldap_anonymous(*args, **kwargs): }) return lc_ldap_local(*args, **kwargs) +if DB_TEST_OVERRIDE: + lc_ldap_admin = lc_ldap_test + lc_ldap_readonly = lc_ldap_test + lc_ldap_local = lc_ldap_test + lc_ldap_anonymous = lc_ldap_test + class with_ldap_conn(object): """Décorateur (instance = decorator) pour les fonctions nécessitant une connexion ldap. Rajoute un argument à la fonction (à la fin) pour passer