whos affiche les VLANs actifs
whos affiche les VLANs actifs sur la prise d'un adherent ou d'un club darcs-hash:20081006234054-b8e4c-c47a7534ec3b246bf18a508bbecc47cb197fdcf5.gz
This commit is contained in:
parent
71f4ee3d0a
commit
0152143fca
1 changed files with 18 additions and 5 deletions
|
@ -446,9 +446,14 @@ def adher_details(adher) :
|
|||
f += coul(u'Chambre invalide\n','violet')
|
||||
else :
|
||||
# Chambre + prise (d'après annuaire)
|
||||
etat, vlans = prise_etat(adher.chbre())
|
||||
f += coul(u'Chambre : ','gras') + u"%s " % chbre
|
||||
f += u'(%s)' % prise_etat(adher.chbre())
|
||||
f += u'(%s)' % etat
|
||||
f += u'\n'
|
||||
# VLAN
|
||||
if vlans :
|
||||
f += coul(u'VLAN : ','gras') + u'%s' % vlans
|
||||
f += u'\n'
|
||||
|
||||
# Études
|
||||
if adher.etudes(1).isdigit() :
|
||||
|
@ -675,6 +680,7 @@ def club_details(club) :
|
|||
# responsale
|
||||
f += coul(u'Responsable : ','gras') + "%s\n" % club.responsable().Nom()
|
||||
|
||||
# Imprimeurs
|
||||
if len(club.imprimeurs()) > 0:
|
||||
f += (coul(u'Imprimeurs : ', 'gras') + "%s\n" % ', '.join(map(lambda x:
|
||||
club.search("aid=%s" % x)['adherent'][0].Nom(), club.imprimeurs())))
|
||||
|
@ -692,9 +698,14 @@ def club_details(club) :
|
|||
f += '\n'
|
||||
|
||||
# Chambre + prise
|
||||
etat, vlans = prise_etat(club.chbre())
|
||||
f += coul(u'Local : ','gras') + "%s " % club.local()
|
||||
f += u'(%s)' % prise_etat(club.chbre())
|
||||
f += u'(%s)' % etat
|
||||
f += u'\n'
|
||||
# VLAN
|
||||
if vlans :
|
||||
f += coul(u'VLAN : ','gras') + u'%s' % vlans
|
||||
f += u'\n'
|
||||
|
||||
# Paiement
|
||||
if club.paiement() :
|
||||
|
@ -861,12 +872,14 @@ def borne_clients_canal(borne) :
|
|||
return {"canal": canal, "mac-rssi": macs}
|
||||
|
||||
def prise_etat(chbre) :
|
||||
""" Retoune l'état de la prise associée à la chbre """
|
||||
""" Retoune un doublet contenant l'état de la prise associée à la chbre et les VLANs actives"""
|
||||
f = u''
|
||||
vlans = u''
|
||||
try:
|
||||
# On met aussi l'état
|
||||
from hptools import sw_chbre, ConversationError
|
||||
prise = sw_chbre(chbre)
|
||||
vlans += ', '.join(prise.vlans())
|
||||
f += u'prise %s' % prise.prise_brute
|
||||
rows, cols = get_screen_size()
|
||||
if prise.is_up() :
|
||||
|
@ -918,7 +931,7 @@ def prise_etat(chbre) :
|
|||
f = r
|
||||
except :
|
||||
f = u'infos prise non dispo : erreur interne'
|
||||
return f
|
||||
return f, vlans
|
||||
|
||||
##############################################################################
|
||||
## Partie dévolue au système de recherche
|
||||
|
@ -1094,7 +1107,7 @@ def __recherche() :
|
|||
if arg.count('=') == 1 and arg.split('=')[0] == 'chbre' :
|
||||
# Affichage des infos de la chambre
|
||||
chbre = arg.split('=')[1]
|
||||
cprint(u"Chambre %s inoccupée ou invalide (%s)" % (chbre,prise_etat(chbre)))
|
||||
cprint(u"Chambre %s inoccupée ou invalide (%s)" % (chbre,prise_etat(chbre)[0]))
|
||||
else :
|
||||
cprint(u"Aucun résultat trouvé.")
|
||||
sys.exit(3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue