[whos/annuaires_pg] affichage commentaire prise
Ignore-this: 5f139b5ce479c654d6ed64dcae6892d2 darcs-hash:20121116234433-28565-b2becfb73c07a025b7b77e465c6792b2b4524a68.gz
This commit is contained in:
parent
9022007377
commit
6089aa2d38
2 changed files with 18 additions and 0 deletions
|
@ -44,6 +44,17 @@ def chbre_prises(batiment, chambre = None):
|
||||||
raise ValueError("Batiment inexistant")
|
raise ValueError("Batiment inexistant")
|
||||||
return ret
|
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):
|
def reverse(batiment, prise = None):
|
||||||
"""Correspondance prise -> chambre"""
|
"""Correspondance prise -> chambre"""
|
||||||
batiment = batiment.lower()
|
batiment = batiment.lower()
|
||||||
|
|
|
@ -1007,6 +1007,13 @@ def prise_etat(chbre) :
|
||||||
f+= u', ' + coul(u'prise désactivée','rouge')
|
f+= u', ' + coul(u'prise désactivée','rouge')
|
||||||
else :
|
else :
|
||||||
f+= u', activée, lien non détecté'
|
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:
|
except ConversationError, r:
|
||||||
# Switch non manageable ou down
|
# Switch non manageable ou down
|
||||||
f += ', '
|
f += ', '
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue