From 010fe3b10ed23237774f08e1db52b2b75f5773c4 Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Tue, 4 Nov 2014 13:20:53 +0100 Subject: [PATCH] DBG_ANNUAIRE: pour l'annuaire pg --- gestion/annuaires_pg.py | 3 ++- testing.sh | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gestion/annuaires_pg.py b/gestion/annuaires_pg.py index 4a7fd263..4babb487 100644 --- a/gestion/annuaires_pg.py +++ b/gestion/annuaires_pg.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +import os import psycopg2 from functools import wraps import time @@ -18,7 +19,7 @@ def _need_conn(f): raise NameError("La connexion à la pase postgresql ne peut être établie.") attempts = 0 while not conn or not attempts: - if __name__.endswith('annuaires_pg_test'): + if __name__.endswith('annuaires_pg_test') or os.getenv('DBG_ANNUAIRE', False): host='localhost' else: host='pgsql.v4.adm.crans.org' diff --git a/testing.sh b/testing.sh index d897957f..0237fc94 100644 --- a/testing.sh +++ b/testing.sh @@ -4,6 +4,9 @@ # Utiliser ldap local export DBG_LDAP=1 +# Utiliser l'annuaire pgsql local +export DBG_ANNUAIRE=1 + # Mails auto, plusieurs valeurs: # * print: affiche le mail au lieu de l'envoyer # * une adresse mail: envoie tous les mails à cette adresse mail au lieu de