diff --git a/gestion/annuaires_pg.py b/gestion/annuaires_pg.py index da0742a7..b91aefd5 100755 --- a/gestion/annuaires_pg.py +++ b/gestion/annuaires_pg.py @@ -44,6 +44,17 @@ def chbre_prises(batiment, chambre = None): raise ValueError("Batiment inexistant") return ret +def chbre_commentaire(batiment, chambre): + """ Renvoie le commentaire associé à la chambre """ + global conn + batiment = batiment.lower() + cur = conn.cursor() + cur.execute("SELECT commentaire FROM prises WHERE (batiment, chambre) = (%s,%s)", (batiment, chambre)) + try: + return cur.fetchone()[0] + except TypeError: + raise ValueError("Chambre inexistante") + def reverse(batiment, prise = None): """Correspondance prise -> chambre""" batiment = batiment.lower() diff --git a/gestion/whos.py b/gestion/whos.py index e733cb9e..8fd6823b 100644 --- a/gestion/whos.py +++ b/gestion/whos.py @@ -1007,6 +1007,13 @@ def prise_etat(chbre) : f+= u', ' + coul(u'prise désactivée','rouge') else : f+= u', activée, lien non détecté' + try: + import annuaires_pg + extra_info = annuaires_pg.chbre_commentaire(chbre[0],chbre[1:]).decode('utf-8') + if extra_info: + f += u'\n' + ' '*10 + extra_info + except ValueError: + pass except ConversationError, r: # Switch non manageable ou down f += ', '