From 2ffb7ca2f7d26350f34ba4fbb54289b5976ad149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= Date: Wed, 18 Feb 2015 20:43:33 +0100 Subject: [PATCH] =?UTF-8?q?On=20ajoute=20le=20b=C3=A2timent=20v=20dans=20l?= =?UTF-8?q?es=20configs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gestion/annuaires_pg.py | 3 ++- gestion/config/config.py | 4 ++++ gestion/whos.py | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gestion/annuaires_pg.py b/gestion/annuaires_pg.py index 0c6c81f0..3ed82640 100644 --- a/gestion/annuaires_pg.py +++ b/gestion/annuaires_pg.py @@ -42,7 +42,8 @@ def _need_conn(f): # backend pgsql. On utilise donc une exception plus standard return first_connect -bat_switchs = ["a", "b", "c", "g", "h", "i", "j", "m", "o", "p"] +# Le v est virtuel. +bat_switchs = ["a", "b", "c", "g", "h", "i", "j", "m", "o", "p", "v"] class ChbreNotFound(ValueError): """Lorsqu'une chambre n'existe pas""" diff --git a/gestion/config/config.py b/gestion/config/config.py index 12aca656..9fc98ee8 100644 --- a/gestion/config/config.py +++ b/gestion/config/config.py @@ -451,3 +451,7 @@ accueil_route = { } dhcp_servers = ['dhcp.adm.crans.org', 'isc.adm.crans.org'] + +# Le bâtiment virtuel dans lequel on place des chambres qui n'existent pas, pour faire +# des tests. +bat_virtuel = 'v' diff --git a/gestion/whos.py b/gestion/whos.py index 07ece5d4..435c1f8f 100755 --- a/gestion/whos.py +++ b/gestion/whos.py @@ -613,7 +613,12 @@ def adher_details(adher) : f += coul(u'Chambre invalide\n','violet') else : # Chambre + prise (d'après annuaire) - etat, vlans, cablage = prise_etat(adher.chbre()) + if adher.chbre()[0].lower() != config.bat_virtuel: + etat, vlans, cablage = prise_etat(adher.chbre()) + else: + etat = coul(u"Chambre virtuelle", "violet") + vlans = "" + cablage = coul(u"Factice", "violet") f += coul(u'Chambre : ','gras') + u"%s " % chbre f += u'(%s)' % etat f += u'\n'