mail: (strftime's encoding) patch plus propre
This commit is contained in:
parent
8928a950c7
commit
be3f3507cc
1 changed files with 8 additions and 4 deletions
|
@ -35,11 +35,15 @@ templateLoader = jinja2.FileSystemLoader( searchpath=["/", template_path] )
|
|||
templateEnv = jinja2.Environment( loader=templateLoader )
|
||||
|
||||
def format_date(d):
|
||||
# Beware: l'encodage utilisé ici dépend de la locale choisie plus bas
|
||||
if 'fr_FR' in locale.getlocale():
|
||||
return d.strftime('%A %d %B %Y').decode('utf-8')
|
||||
""" Renvoie une jolie représentation (unicode) d'un datetime"""
|
||||
# L'encoding dépend de ce qu'on a choisi plus bas
|
||||
lang, encoding = locale.getlocale()
|
||||
if not encoding:
|
||||
encoding = 'ascii'
|
||||
if lang == 'fr_FR':
|
||||
return d.strftime('%A %d %B %Y').decode(encoding)
|
||||
else:
|
||||
return d.strftime('%A, %B %d %Y').decode('utf-8')
|
||||
return d.strftime('%A, %B %d %Y').decode(encoding)
|
||||
|
||||
def given_name(adh):
|
||||
if 'club' in adh['objectClass']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue