From 92d082e4e7254b947e254cf627b9d6592924e71b Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Wed, 17 Jun 2015 10:22:30 +0200 Subject: [PATCH] =?UTF-8?q?shortcuts/test:=20r=C3=A9cup=C3=A8re=20host=20d?= =?UTF-8?q?ans=20DBG=5FLDAP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shortcuts.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shortcuts.py b/shortcuts.py index 87881a0..8c4910c 100644 --- a/shortcuts.py +++ b/shortcuts.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """ Raccourcis pour se connecter facilement à la base LDAP avec le binding lc_ldap. """ @@ -36,7 +35,9 @@ if isinstance(current_user, str): #: Les racourcis définis plus bas pointent tous vers lc_ldap_test en mode # debug -DB_TEST_OVERRIDE = bool(os.getenv('DBG_LDAP', False)) +DB_TEST_OVERRIDE = os.getenv('DBG_LDAP', None) +if DB_TEST_OVERRIDE == '1': + DB_TEST_OVERRIDE = 'localhost' def lc_ldap(*args, **kwargs): """Renvoie une connexion à la base LDAP.""" @@ -50,7 +51,7 @@ def lc_ldap_test(*args, **kwargs): except OSError: pass # On impose le serveur - kwargs["uri"] = 'ldap://vo.adm.crans.org' + kwargs["uri"] = 'ldap://%s' % DB_TEST_OVERRIDE kwargs.setdefault("dn", 'cn=admin,dc=crans,dc=org') # Le mot de passe de la base de test kwargs.setdefault("cred", variables.ldap_test_password)