← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Convert LibraryBackedByteStorage to BytesIO

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/389210
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-librarybackedbytestorage-bytesio into launchpad:master.
diff --git a/lib/lp/services/webservice/bytestorage.py b/lib/lp/services/webservice/bytestorage.py
index 9fa0db3..e8a8535 100644
--- a/lib/lp/services/webservice/bytestorage.py
+++ b/lib/lp/services/webservice/bytestorage.py
@@ -9,7 +9,7 @@ __all__ = [
 ]
 
 
-from cStringIO import StringIO
+from io import BytesIO
 
 from lazr.restful.interfaces import IByteStorage
 from zope.component import (
@@ -79,7 +79,7 @@ class LibraryBackedByteStorage:
             filename = self.filename
         stored = getUtility(ILibraryFileAliasSet).create(
             name=filename, size=len(representation),
-            file=StringIO(representation), contentType=mediaType)
+            file=BytesIO(representation), contentType=mediaType)
         setattr(self.entry, self.field.__name__, stored)
 
     def deleteStored(self):