From 8c8ac24c5439fe8dda0770dd76b99c3807c1d11f Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Mon, 29 Jun 2015 01:09:13 +0200 Subject: [PATCH] =?UTF-8?q?annuaires:=20vire=20mentions=20c=C3=A2blage=20c?= =?UTF-8?q?rans-crous?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gestion/annuaires_pg.py | 22 ---------------------- gestion/ldap_crans.py | 27 ++------------------------- gestion/whos.py | 9 +-------- 3 files changed, 3 insertions(+), 55 deletions(-) diff --git a/gestion/annuaires_pg.py b/gestion/annuaires_pg.py index 58dbd57d..61569568 100644 --- a/gestion/annuaires_pg.py +++ b/gestion/annuaires_pg.py @@ -109,16 +109,6 @@ def reverse(batiment, prise = None): if not ret: raise ValueError("Batiment %s inexistant" % batiment) 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 def is_connected(batiment, chambre): """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)) 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 uplink_prises={ 'a' : { 49 : 'uplink->bata-4', 50 : 'libre-service', diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index 871e2501..e29ffd9a 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -1991,31 +1991,8 @@ class BaseProprietaire(BaseClasseCrans): 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"): - while True: - bat = self._data['chbre'][0][0] - 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 + bat = self._data['chbre'][0][0] + ch = self._data['chbre'][0][1:] # Enregistrement self._save() diff --git a/gestion/whos.py b/gestion/whos.py index 05350d95..c9ffccf5 100755 --- a/gestion/whos.py +++ b/gestion/whos.py @@ -1158,14 +1158,7 @@ def prise_etat(chbre) : # On met aussi l'état prise = sw_chbre(chbre) 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 rows, cols = get_screen_size() if prise.is_up() :