Browse Source

Use io.open for py2.7 in DataArchive

Rafał Pitoń 7 years ago
parent
commit
9085b8b537
1 changed files with 2 additions and 1 deletions
  1. 2 1
      misago/users/dataarchive.py

+ 2 - 1
misago/users/dataarchive.py

@@ -1,3 +1,4 @@
+import io  # fixme: remove explicit io imports after going py3k-only
 import os
 import os
 import shutil
 import shutil
 
 
@@ -77,7 +78,7 @@ class DataArchive(object):
         clean_filename = slugify(str(name))
         clean_filename = slugify(str(name))
         file_dir_path = self.make_final_path(date=date, directory=directory)
         file_dir_path = self.make_final_path(date=date, directory=directory)
         file_path = os.path.join(file_dir_path, '{}.txt'.format(clean_filename))
         file_path = os.path.join(file_dir_path, '{}.txt'.format(clean_filename))
-        with open(file_path, 'w+') as fp:
+        with io.open(file_path, 'w', encoding='utf-8') as fp:
             fp.write(six.text_type(value))
             fp.write(six.text_type(value))
             return file_path
             return file_path