PY3 fixes and added tests for gluon/admin.py

This commit is contained in:
ilvalle
2016-06-24 22:54:56 +02:00
parent 48350664f0
commit 8aecaf4514
19 changed files with 75 additions and 69 deletions
+4 -1
View File
@@ -115,7 +115,10 @@ def write_file(filename, value, mode='w'):
"""Writes <value> to filename, making sure to close the file
explicitly on exit.
"""
f = open(filename, mode)
if PY2:
f = open(filename, mode)
else:
f = open(filename, mode, encoding="utf8")
try:
return f.write(value)
finally: