From 611b9c8061e6526bdf679f5a9f81f0106acaebb4 Mon Sep 17 00:00:00 2001 From: pauget Date: Sat, 9 Oct 2004 16:50:48 +0200 Subject: [PATCH] Salloperie d'encodage, ca devrai mieux aller. darcs-hash:20041009145048-41617-736acd2ee276b47ecb09039bde0b0281a48183b2.gz --- gestion/whos.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/gestion/whos.py b/gestion/whos.py index 698815ae..84025ce2 100755 --- a/gestion/whos.py +++ b/gestion/whos.py @@ -53,6 +53,10 @@ limit_aff_details = 1 limit_aff_historique = 4 aff_ipsec = 0 +def unicode_print(truc) : + """ Conversion de truc en iso-8859-15 puis affichage à l'écran """ + print truc.encode('iso-8859-15','ignore') + def aff(qqch,mtech=0) : """ Affichage de qqch. qqch peut être une liste d'instances des classes adhérent ou machine @@ -63,29 +67,29 @@ def aff(qqch,mtech=0) : si qqch est une instance seul la traité comme une liste à une élément Si mtech = 1 affiches les infomations techniques des machines plutot qu'administratives dans le tableau des propriétés - """ + """ if type(qqch) != list : qqch = [ qqch ] if len(qqch) > limit_aff_details : t = qqch[0].idn if t == 'aid' : - print adhers_brief(qqch) + unicode_print(adhers_brief(qqch)) elif t == 'mid' : - if mtech : print list_machines(qqch) - else : print machines_brief(qqch) + if mtech : unicode_print(list_machines(qqch)) + else : unicode_print(machines_brief(qqch)) elif t == 'cid' : - print clubs_brief(qqch) + unicode_print(clubs_brief(qqch)) else : i = 0 for c in qqch : t = c.idn if i : print coul(u'='*80,'cyan') i = 1 - if t == 'aid' : print adher_details(c) + if t == 'aid' : unicode_print(adher_details(c)) elif t == 'mid' : - print machine_details(c) - elif t == 'cid' : print club_details(c) + unicode_print(machine_details(c)) + elif t == 'cid' : unicode_print(club_details(c)) if len(qqch) > 1: print "Total: %d" % len(qqch) @@ -789,7 +793,7 @@ def __recherche() : sys.exit(4) else : if len(res['machine']) > limit_aff_details : - print list_bornes(res['machine']) + unicode_print(list_bornes(res['machine'])) else : aff(res['machine']) elif only_adh :