Rcriture de generate pour la migration.
Mise en place du firewall sur toutes les machines darcs-hash:20050611170224-41617-068d285a581f2c65799ca3fbe33a57a3075b9d03.gz
This commit is contained in:
parent
cf8b87b9b9
commit
caf1bb803e
11 changed files with 1681 additions and 1666 deletions
|
@ -330,8 +330,8 @@ def adher_details(adher) :
|
|||
else :
|
||||
# Chambre + prise (d'après annuaire)
|
||||
f += coul(u'Chambre : ','gras') + u"%s " % chbre
|
||||
f += '(%s)' % prise_etat(adher.chbre())
|
||||
f += '\n'
|
||||
f += u'(%s)' % prise_etat(adher.chbre())
|
||||
f += u'\n'
|
||||
|
||||
# Etudes
|
||||
if adher.etudes(1).isdigit() :
|
||||
|
@ -527,8 +527,8 @@ def club_details(club) :
|
|||
|
||||
# Chambre + prise
|
||||
f += coul(u'Local : ','gras') + "%s " % club.local()
|
||||
f += '(%s)' % prise_etat(club.chbre())
|
||||
f += '\n'
|
||||
f += u'(%s)' % prise_etat(club.chbre())
|
||||
f += u'\n'
|
||||
|
||||
# Paiement
|
||||
if club.paiement() :
|
||||
|
@ -667,30 +667,30 @@ def borne_clients(borne) :
|
|||
|
||||
def prise_etat(chbre) :
|
||||
""" Retoune l'état de la prise associée à la chbre """
|
||||
f = ''
|
||||
try :
|
||||
f = u''
|
||||
try:
|
||||
# On met aussi l'état
|
||||
from hptools import sw_chbre
|
||||
prise = sw_chbre(chbre)
|
||||
f += 'prise %s' % prise.prise_brute
|
||||
f += u'prise %s' % prise.prise_brute
|
||||
rows, cols = get_screen_size()
|
||||
if prise.is_up() :
|
||||
f += ', ' + coul('machine branchée','vert')
|
||||
f += u', ' + coul(u'machine branchée','vert')
|
||||
reste_cols = cols - 45
|
||||
if prise.eth_mode().find('10Mbits')!=-1 :
|
||||
f+= ', ' + coul('prise en 10Mbps','jaune')
|
||||
f+= u', ' + coul(u'prise en 10Mbps','jaune')
|
||||
reste_cols -= 17
|
||||
f+=', '
|
||||
macs = prise.show_prise_mac()
|
||||
if len(macs) == 0:
|
||||
if reste_cols < 20 :
|
||||
# Faut aller à la ligne
|
||||
f += '\n '
|
||||
f += coul('aucune MAC détectée', 'jaune')
|
||||
f += u'\n '
|
||||
f += coul(u'aucune MAC détectée', 'jaune')
|
||||
else:
|
||||
if len(macs) == 1 and reste_cols > 25 :
|
||||
# Une seule mac et on a assez de place
|
||||
f += "MAC: %s" % macs[0]
|
||||
f += u"MAC: %s" % macs[0]
|
||||
else :
|
||||
# On va à la ligne
|
||||
# Combien d'adresses MAC peut-on mettre par ligne ?
|
||||
|
@ -700,18 +700,18 @@ def prise_etat(chbre) :
|
|||
count = 0
|
||||
while len(macs) > 0:
|
||||
if count % parligne == 0:
|
||||
f += '\n MACs: '
|
||||
f += u'\n MACs: '
|
||||
else:
|
||||
f += ', '
|
||||
f += "%s" % macs.pop()
|
||||
f += u', '
|
||||
f += u"%s" % macs.pop()
|
||||
count += 1
|
||||
elif not prise.is_enable() :
|
||||
f+= ', ' + coul('prise désactivée','rouge')
|
||||
f+= u', ' + coul(u'prise désactivée','rouge')
|
||||
else :
|
||||
f+= ', activée, lien non détecté'
|
||||
f+= u', activée, lien non détecté'
|
||||
except :
|
||||
# Switch non manageable
|
||||
f = 'informations prise non disponibles'
|
||||
f = u'informations prise non disponibles'
|
||||
|
||||
return f
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue