annuaires: vire mentions câblage crans-crous
This commit is contained in:
parent
2bcce4911f
commit
8c8ac24c54
3 changed files with 3 additions and 55 deletions
|
@ -109,16 +109,6 @@ def reverse(batiment, prise = None):
|
||||||
if not ret:
|
if not ret:
|
||||||
raise ValueError("Batiment %s inexistant" % batiment)
|
raise ValueError("Batiment %s inexistant" % batiment)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@_need_conn
|
|
||||||
def is_crans(batiment, chambre):
|
|
||||||
"""Chambre cablee au Cr@ns ?"""
|
|
||||||
batiment = batiment.lower()
|
|
||||||
chambre = chambre.lower()
|
|
||||||
cur = conn.cursor()
|
|
||||||
cur.execute("SELECT crans FROM prises WHERE (batiment, chambre) = (%s, %s)", (batiment, chambre))
|
|
||||||
return cur.fetchone()[0]
|
|
||||||
|
|
||||||
@_need_conn
|
@_need_conn
|
||||||
def is_connected(batiment, chambre):
|
def is_connected(batiment, chambre):
|
||||||
"""Cablage physique effectue ?"""
|
"""Cablage physique effectue ?"""
|
||||||
|
@ -128,18 +118,6 @@ def is_connected(batiment, chambre):
|
||||||
cur.execute("SELECT cablage_effectue FROM prises WHERE (batiment, chambre) = (%s, %s)", (batiment, chambre))
|
cur.execute("SELECT cablage_effectue FROM prises WHERE (batiment, chambre) = (%s, %s)", (batiment, chambre))
|
||||||
return cur.fetchone()[0]
|
return cur.fetchone()[0]
|
||||||
|
|
||||||
@_need_conn
|
|
||||||
def crous_to_crans(batiment, chambre):
|
|
||||||
"""Passage d'une chambre de CROUS a Cr@ns"""
|
|
||||||
batiment = batiment.lower()
|
|
||||||
chambre = chambre.lower()
|
|
||||||
if is_crans(batiment, chambre):
|
|
||||||
return
|
|
||||||
cur = conn.cursor()
|
|
||||||
cur.execute("UPDATE prises SET (crans, crous, cablage_effectue) = (TRUE, FALSE, not cablage_effectue) WHERE (batiment, chambre) = (%s, %s)", (batiment, chambre))
|
|
||||||
conn.commit()
|
|
||||||
cur.close()
|
|
||||||
|
|
||||||
# Prises d'uplink, de machines du crans / Prises d'utilité CRANS
|
# Prises d'uplink, de machines du crans / Prises d'utilité CRANS
|
||||||
uplink_prises={ 'a' :
|
uplink_prises={ 'a' :
|
||||||
{ 49 : 'uplink->bata-4', 50 : 'libre-service',
|
{ 49 : 'uplink->bata-4', 50 : 'libre-service',
|
||||||
|
|
|
@ -1991,31 +1991,8 @@ class BaseProprietaire(BaseClasseCrans):
|
||||||
self.services_to_restart('bl_chbre_invalide')
|
self.services_to_restart('bl_chbre_invalide')
|
||||||
|
|
||||||
if ('chbre' in self.modifs or 'paiement' in self.modifs) and self._data['chbre'][0] not in ("????", "EXT"):
|
if ('chbre' in self.modifs or 'paiement' in self.modifs) and self._data['chbre'][0] not in ("????", "EXT"):
|
||||||
while True:
|
|
||||||
bat = self._data['chbre'][0][0]
|
bat = self._data['chbre'][0][0]
|
||||||
ch = self._data['chbre'][0][1:]
|
ch = self._data['chbre'][0][1:]
|
||||||
if annuaires.is_crans(bat, ch):
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
r = prompt(u"La chambre %s est câblée sur le réseau CROUS. Est-ce *bien* la chambre de l'adhérent ? [O/N]" % self._data['chbre'][0], "O")
|
|
||||||
if r == 'O' or r == 'o':
|
|
||||||
annuaires.crous_to_crans(bat, ch)
|
|
||||||
else:
|
|
||||||
while True:
|
|
||||||
new_ch = prompt(u"Chambre de l'adhérent ?")
|
|
||||||
try:
|
|
||||||
self.chbre(new_ch)
|
|
||||||
except ValueError, c:
|
|
||||||
if len(c.args) == 2:
|
|
||||||
old_adh = c.args[1]
|
|
||||||
r = prompt(u"Changer %s de chambre ? [O/N]" % old_adh.Nom(), "n")
|
|
||||||
if r == 'O' or r == 'o':
|
|
||||||
old_adh.chbre('????')
|
|
||||||
old_adh.save()
|
|
||||||
self.chbre(new_ch)
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
break
|
|
||||||
|
|
||||||
# Enregistrement
|
# Enregistrement
|
||||||
self._save()
|
self._save()
|
||||||
|
|
|
@ -1158,14 +1158,7 @@ def prise_etat(chbre) :
|
||||||
# On met aussi l'état
|
# On met aussi l'état
|
||||||
prise = sw_chbre(chbre)
|
prise = sw_chbre(chbre)
|
||||||
vlans += ', '.join(prise.vlans())
|
vlans += ', '.join(prise.vlans())
|
||||||
if annuaires_pg.is_crans(chbre[0],chbre[1:]) :
|
|
||||||
cablage += coul(u'Cr@ns','bleu')
|
|
||||||
else :
|
|
||||||
cablage += coul(u'CROUS','jaune')
|
|
||||||
if annuaires_pg.is_connected(chbre[0],chbre[1:]) :
|
|
||||||
cablage += u'.'
|
|
||||||
else :
|
|
||||||
cablage += u', ' + coul(u'cablage non effectué !','rouge')
|
|
||||||
f += u'prise %s' % prise.prise_brute
|
f += u'prise %s' % prise.prise_brute
|
||||||
rows, cols = get_screen_size()
|
rows, cols = get_screen_size()
|
||||||
if prise.is_up() :
|
if prise.is_up() :
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue