Skip to content
Snippets Groups Projects
Commit 691bc29f authored by Vincent Le gallic's avatar Vincent Le gallic
Browse files

Unicodification

parent 8d4cda9f
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ def writefile(filename, contents): ...@@ -38,7 +38,7 @@ def writefile(filename, contents):
"""Écrit le fichier avec les bons droits UNIX""" """Écrit le fichier avec les bons droits UNIX"""
os.umask(0077) os.umask(0077)
f = open(filename, 'w') f = open(filename, 'w')
f.write(contents) f.write(contents.encode("utf-8"))
f.close() f.close()
def listroles(): def listroles():
...@@ -87,7 +87,7 @@ def putfile(filename): ...@@ -87,7 +87,7 @@ def putfile(filename):
old = getfile(filename) old = getfile(filename)
oldroles = old['roles'] oldroles = old['roles']
except TypeError: except TypeError:
old = "[Création du fichier]" old = u"[Création du fichier]"
pass pass
else: else:
if not validate(oldroles,'w'): if not validate(oldroles,'w'):
...@@ -134,19 +134,15 @@ def notification(subject, corps, fname, old): ...@@ -134,19 +134,15 @@ def notification(subject, corps, fname, old):
tomail = DEST_MAIL tomail = DEST_MAIL
msg = MIMEMultipart(_charset="utf-8") msg = MIMEMultipart(_charset="utf-8")
msg['Subject'] = subject msg['Subject'] = subject
msg['X-Mailer'] = "cranspasswords" msg['X-Mailer'] = u"cranspasswords"
msg['From'] = CRANSP_MAIL msg['From'] = CRANSP_MAIL
msg['To'] = DEST_MAIL msg['To'] = DEST_MAIL
msg.preamble = "cranspasswords report" msg.preamble = u"cranspasswords report"
info = MIMEText(corps + info = MIMEText(corps +
"\nLa version précédente a été sauvegardée." + u"\nLa version précédente a été sauvegardée." +
#"\nCi-joint l'ancien fichier." + u"\n\n-- \nCranspasswords.py", _charset="utf-8")
"\n\n-- \nCranspasswords.py",_charset="utf-8")
msg.attach(info) msg.attach(info)
#old = MIMEText(old) conn.sendmail(frommail, tomail, msg.as_string())
#old.add_header('Content-Disposition', 'attachment', filename=fname)
#msg.attach(str(old))
conn.sendmail(frommail,tomail,msg.as_string())
conn.quit() conn.quit()
WRITE_COMMANDS = ["putfile", "rmfile"] WRITE_COMMANDS = ["putfile", "rmfile"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment