[wifi/status.py] on peut préciser le fichier d'output
darcs-hash:20100524230646-bd074-f76fc5d753393c5fe4999ce2617a49188a98cf12.gz
This commit is contained in:
parent
207477d711
commit
d1480862b0
1 changed files with 13 additions and 4 deletions
|
@ -3,12 +3,16 @@
|
|||
|
||||
# Génération d'un fichier XML indiquant le status des bornes
|
||||
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
import sys, os, time, optparse
|
||||
sys.path.append("/usr/scripts/gestion")
|
||||
sys.path.append("/usr/scripts/wifi")
|
||||
|
||||
### parsing
|
||||
parser = optparse.OptionParser(usage="usage: %prog [-o FILE]")
|
||||
parser.add_option('-o', '--output', help=u"outputs to FILE",
|
||||
metavar='FILE', dest="filename")
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
from bornes import bornes_canal, bornes_clients, bornes_uptime
|
||||
|
||||
from ldap_crans import crans_ldap
|
||||
|
@ -88,4 +92,9 @@ for b in bornes:
|
|||
|
||||
xml_bornes.appendChild(xml_borne)
|
||||
|
||||
if options.filename:
|
||||
f = open(options.filename, 'w')
|
||||
f.write(status.toxml().encode("UTF-8"))
|
||||
f.close()
|
||||
else:
|
||||
print (status.toxml().encode("UTF-8"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue