← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-translation-export-bytesio into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-translation-export-bytesio into launchpad:master.

Commit message:
Port lp.translations.utilities.translation_export to BytesIO

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/391260

SingleFileStorageStrategy.content is always bytes.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-translation-export-bytesio into launchpad:master.
diff --git a/lib/lp/translations/utilities/translation_export.py b/lib/lp/translations/utilities/translation_export.py
index aede124..402e089 100644
--- a/lib/lp/translations/utilities/translation_export.py
+++ b/lib/lp/translations/utilities/translation_export.py
@@ -11,7 +11,7 @@ __all__ = [
     'TranslationExporter',
     ]
 
-from StringIO import StringIO
+import io
 import tempfile
 
 from zope.component import subscribers
@@ -159,7 +159,7 @@ class SingleFileStorageStrategy(StorageStrategy):
     def export(self):
         """See `StorageStrategy`."""
         assert self.path is not None, "Exporting empty file."
-        output = ExportedTranslationFile(StringIO(self.content))
+        output = ExportedTranslationFile(io.BytesIO(self.content))
         output.path = self.path
         # We use x-po for consistency with other .po editors like GTranslator.
         output.content_type = self.mime_type