From dba7ad88e622fd897fb500e39668c4033e32cbe1 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Tue, 21 May 2013 13:59:44 +0200 Subject: [PATCH] [annuaires_pg] Messages d'erreur plus verbeux --- gestion/annuaires_pg.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gestion/annuaires_pg.py b/gestion/annuaires_pg.py index 13ab73ce..13372af1 100755 --- a/gestion/annuaires_pg.py +++ b/gestion/annuaires_pg.py @@ -35,7 +35,7 @@ def chbre_prises(batiment, chambre = None): try: return "%03d" % cur.fetchone()[0] except TypeError: - raise ValueError("Chambre inexistante") + raise ValueError("Chambre inexistante bat %r, chbre %r" % (batiment, chambre)) else: cur = conn.cursor() cur.execute("SELECT chambre, prise_crans FROM prises WHERE batiment = %s", batiment) @@ -43,7 +43,7 @@ def chbre_prises(batiment, chambre = None): for chambre, prise_crans in cur.fetchall(): ret[chambre] = "%03d" % prise_crans if not ret: - raise ValueError("Batiment inexistant") + raise ValueError("Batiment %s inexistant" % batiment) return ret @_need_conn @@ -56,7 +56,7 @@ def chbre_commentaire(batiment, chambre): try: return cur.fetchone()[0] except TypeError: - raise ValueError("Chambre inexistante") + raise ValueError("Chambre inexistante bat %r, chbre %r" % (batiment, chambre)) @_need_conn def reverse(batiment, prise = None): @@ -68,7 +68,7 @@ def reverse(batiment, prise = None): try: return [chbre for (chbre,) in cur.fetchall()] except TypeError: - raise ValueError("Prise inexistante") + raise ValueError("Prise %s inexistante" % prise) else: cur = conn.cursor() cur.execute("SELECT chambre, prise_crans FROM prises WHERE batiment = %s", batiment) @@ -80,7 +80,7 @@ def reverse(batiment, prise = None): ret["%03d" % prise_crans] = [chambre] if not ret: - raise ValueError("Batiment inexistant") + raise ValueError("Batiment %s inexistant" % batiment) return ret @_need_conn