on force l'encodage ici sinon il est fait au moment de l'impression a

l'ecran et il empeche l'affichage de toutes les infos.
Les problmes d'encodage viennent des caractres exotiques dans les noms de fichiers imprims avec l'intranet depuis un systme d'exploitation exotique.

darcs-hash:20061201135916-f46e9-3d181872a037e2a2be82d703aee4c618461c2a63.gz
This commit is contained in:
gdetrez 2006-12-01 14:59:16 +01:00
parent c469b9d8b3
commit 1c05521bd2

View file

@ -96,6 +96,8 @@ def aff(qqch,mtech=0) :
cprint(machine_details(c).strip())
elif t == 'cid':
cprint(club_details(c).strip())
# affiche le nombre de résultats
if len(qqch) > 1:
cprint(u"Total: %d" % len(qqch))
@ -322,7 +324,7 @@ def adher_details(adher) :
"""
Affichage du détail des propriétés d'un adhérent
"""
f=''
f=u''
# Aid
f+= coul(u'aid=%s ' % adher.id() ,'bleu')
# Nom, prenom
@ -330,19 +332,19 @@ def adher_details(adher) :
# Mail
GL = RMH = u''
if adher.mail().find('@')!=-1 :
f += coul(u'Adresse mail : ','gras') + "%s\n" % adher.mail()
if adher.mail().find(u'@')!=-1 :
f += coul(u'Adresse mail : ','gras') + u"%s\n" % adher.mail()
else :
f += coul(u'Login : ','gras') + "%s\t" % adher.mail()
f += coul(u'Login : ','gras') + u"%s\t" % adher.mail()
# controurneGreylisting
if not adher.contourneGreylist():
GL = u' (%s)'%coul(u'GreyList','gris')
if adher.rewriteMailHeaders():
RMH = u' (%s)'%coul(u'réécriture en-têtes mail','gris')
alias = ', '.join([adher.canonical_alias()] + adher.alias())
alias = u', '.join([adher.canonical_alias()] + adher.alias())
if alias:
if alias[0] == ',':
if alias[0] == u',':
# Canonical étéait vide
alias = alias[2:]
f += coul(u'Alias : ','gras') + alias
@ -352,9 +354,9 @@ def adher_details(adher) :
try:
forward = file("/home/%s/.forward" % adher.compte()).readlines()
if len(forward) > 1:
forward = forward[0].strip() + " ...\n"
forward = forward[0].strip() + u" ...\n"
elif len(forward) == 1:
forward = forward[0].strip() + "\n"
forward = forward[0].strip() + u"\n"
if forward:
f += coul(u'Redirection : ', 'gras') + forward
except IOError, e:
@ -387,7 +389,7 @@ def adher_details(adher) :
if 'k' not in adher.controle():
f += u' (caution non payée)'
f += '\n'
# Telephone
tel = adher.tel()
if tel != 'inconnu' :
@ -468,7 +470,7 @@ def adher_details(adher) :
f += _blacklist(adher)
f += _info(adher)
f += _hist(adher)
# Formatage des machines aussi
f += coul(u'Machine(s) : ','gras')
m = adher.machines()
@ -728,7 +730,7 @@ def _info(clas) :
def _hist(clas) :
""" Formatage de l'historique de la classe fournie """
if limit_aff_historique==0 : return ''
f=''
f=u''
h = clas.historique()
h.reverse()
if h :
@ -737,7 +739,15 @@ def _hist(clas) :
try :
a = h[i] # Produit une erreur si i trop grand
if i !=0 : f += ' '
f += '%s\n' % a
try:
# on force l'encodage ici sinon il est fait au moment de l'impression a
# l'ecran et il empeche l'affichage de toutes les infos
f += u'%s\n' % a.encode().decode()
except Exception, e:
if debug:
f += coul(u'*** non affichable [%s] ***\n' % str(e), 'rouge')
else:
f += coul(u'*** non affichable ***\n', 'rouge')
except :
break
try :
@ -967,7 +977,7 @@ def __recherche() :
__usage_brief(u'Valeur du paramètre %s incorecte (doit être un entier positif)' % opt)
elif opt == '-L' or opt =='--limit-historique':
# Limitation du nombre de lignes d'historique
try : limit_aff_historique = int(val)
try : limit_affv_historique = int(val)
except :
__usage_brief(u'Valeur du paramètre %s incorecte (doit être un entier positif)' % opt)
elif opt in [ '-a', '--adherent' ] :