← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Convert ImageChangeWidget to BytesIO

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/389207
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-imagechangewidget-bytesio into launchpad:master.
diff --git a/lib/lp/app/widgets/image.py b/lib/lp/app/widgets/image.py
index 92e2ed4..03fca1f 100644
--- a/lib/lp/app/widgets/image.py
+++ b/lib/lp/app/widgets/image.py
@@ -3,7 +3,7 @@
 
 __metaclass__ = type
 
-from StringIO import StringIO
+from io import BytesIO
 
 from zope.component import getUtility
 from zope.contenttype import guess_content_type
@@ -162,7 +162,7 @@ class ImageChangeWidget(SimpleInputWidget):
                 return existing_alias
 
             self._image_file_alias = getUtility(ILibraryFileAliasSet).create(
-                name=filename, size=len(content), file=StringIO(content),
+                name=filename, size=len(content), file=BytesIO(content),
                 contentType=type)
             return self._image_file_alias
         elif action == "delete":