[impresion, intranet/impression] on relinke correctement

darcs-hash:20090518195027-bd074-77ce9fbfa381a4dd60a3cf75f2acac609e95a9e9.gz
This commit is contained in:
Antoine Durand-Gasselin 2009-05-18 21:50:27 +02:00
parent f9343f336b
commit fbd4c2426d
5 changed files with 38 additions and 25 deletions

View file

@ -5,7 +5,7 @@
Récupère, filtre et formate l'état actuel de l'imprimante
Copyright (c) 2006 by www.crans.org
Copyright (c) 2006, 2007, 2008, 2009 by Cr@ns (http://www.crans.org)
"""
@ -20,17 +20,29 @@ class ErreurCommunication(Exception):
pass
def etat():
exec ("etat_%s()" % impression.imprimante)
exec ("a = etat_%s()" % impression.imprimante)
return a
def etat_canon():
_dico = {
'idle(3)\nrunning(2)' : u'Pas configuré comme une imprimante',
'printing(4)\nrunning(2)' : u'Impression en cours',
'other(1)\ndown(5)' : u"Erreur [grave] de l'imprimante",
'other(1)\nrunning(2)' : u'Imprimante en veille',
'warmup(5)\nrunning(2)' : u'Imprimante en attente',
'idle(3)\nwarning(3)' : u'Warning: ne fonctionne pas',
'printing(4)\nwarning(3)' : u'Warning: imprime (mais warning)',
}
try:
liste_msg = []
msg = liste_msg = []
comm = snmp(host="imprimante.adm.crans.org", version="1", community="public")
for oid in [".hrPrinterStatus.1", ".hrPrinterDetectedErrorState.1"]:
msg = comm.get_string(oid)
if msg: liste_msg.append(msg)
for oid in [".hrPrinterStatus.1", ".hrDeviceStatus.1"]:
#".hrPrinterDetectedErrorState.1"
msg.append(comm.get_string(oid))
liste_msg = [ _dico['\n'.join(msg)] ]
except Exception,err:
liste_msg.append("[%s]" % unicode(err))
return liste_msg
def etat_laserjet():