launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25182
[Merge] ~cjwatson/launchpad:py3-xpiheader-bytesio into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-xpiheader-bytesio into launchpad:master.
Commit message:
Convert XpiHeader to BytesIO
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/389443
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-xpiheader-bytesio into launchpad:master.
diff --git a/lib/lp/translations/utilities/xpi_header.py b/lib/lp/translations/utilities/xpi_header.py
index d2c140e..cbef25c 100644
--- a/lib/lp/translations/utilities/xpi_header.py
+++ b/lib/lp/translations/utilities/xpi_header.py
@@ -8,7 +8,7 @@ __all__ = [
]
from email.utils import parseaddr
-from StringIO import StringIO
+import io
import defusedxml.cElementTree as cElementTree
import six
@@ -67,7 +67,8 @@ class XpiHeader:
# proper unicode strings. Use our raw input instead.
try:
parse = cElementTree.iterparse(
- StringIO(self._raw_content), forbid_dtd=True)
+ io.BytesIO(six.ensure_binary(self._raw_content)),
+ forbid_dtd=True)
for event, elem in parse:
if elem.tag == contributor_tag:
# An XPI header can list multiple contributors, but