[wiki] dans scripts il n'y a que les macros
On peut donc ranger tout ça différamment darcs-hash:20090427172846-bd074-e5e593492feb22017bf9d141c14fdca91c3104da.gz
This commit is contained in:
parent
b8f503d188
commit
5f26116790
30 changed files with 0 additions and 0 deletions
28
wiki-lenny/macro/EtatSecours.py
Normal file
28
wiki-lenny/macro/EtatSecours.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
# -*- coding: iso-8859-1 -*-
|
||||
|
||||
import sys
|
||||
sys.path.append('/usr/scripts/secours')
|
||||
import secours
|
||||
|
||||
def Cellule(texte, couleur, f) :
|
||||
"""
|
||||
Retourne le code HTML d'une cellule formattée aver le formatter f
|
||||
"""
|
||||
code = f.table(1)
|
||||
code += f.table_row(1)
|
||||
code += f.table_cell(1,{'style':'background-color:%s; color: black;' % couleur })
|
||||
code += f.text(texte)
|
||||
code += f.table_cell(0)
|
||||
code += f.table_row(0)
|
||||
code += f.table(0)
|
||||
return code
|
||||
|
||||
def execute(macro, text) :
|
||||
try:
|
||||
f = open(secours.ETAT_MAITRE)
|
||||
if f.readline().strip() == 'normal':
|
||||
return Cellule('Nous sommes actuellement en connexion normale.','lime',macro.formatter)
|
||||
else :
|
||||
return Cellule('Nous sommes actuellement en connexion de secours.','red',macro.formatter)
|
||||
except :
|
||||
return Cellule('Impossible de déterminer l\'état de la connexion.','yellow',macro.formatter)
|
Loading…
Add table
Add a link
Reference in a new issue