launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24396
[Merge] ~cjwatson/launchpad:temporaryblobmanager-new-bytes into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:temporaryblobmanager-new-bytes into launchpad:master.
Commit message:
Make TemporaryBlobManager.new take blob as bytes
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/379996
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:temporaryblobmanager-new-bytes into launchpad:master.
diff --git a/lib/lp/bugs/tests/test_apportjob.py b/lib/lp/bugs/tests/test_apportjob.py
index 076ac2f..c0b4799 100644
--- a/lib/lp/bugs/tests/test_apportjob.py
+++ b/lib/lp/bugs/tests/test_apportjob.py
@@ -342,7 +342,7 @@ class TestTemporaryBlobStorageAddView(TestCaseWithFactory):
# Create a BLOB using existing testing data.
testfiles = os.path.join(config.root, 'lib/lp/bugs/tests/testfiles')
blob_file = open(
- os.path.join(testfiles, 'extra_filebug_data.msg'))
+ os.path.join(testfiles, 'extra_filebug_data.msg'), 'rb')
self.blob_data = blob_file.read()
blob_file.close()
diff --git a/lib/lp/services/temporaryblobstorage/model.py b/lib/lp/services/temporaryblobstorage/model.py
index 287b002..b4e42e8 100644
--- a/lib/lp/services/temporaryblobstorage/model.py
+++ b/lib/lp/services/temporaryblobstorage/model.py
@@ -9,8 +9,8 @@ __all__ = [
]
-from cStringIO import StringIO
from datetime import timedelta
+from io import BytesIO
import uuid
from sqlobject import (
@@ -124,7 +124,7 @@ class TemporaryStorageManager:
secret = str(uuid.uuid1())
file_alias = getUtility(ILibraryFileAliasSet).create(
- secret, len(blob), StringIO(blob),
+ secret, len(blob), BytesIO(blob),
'application/octet-stream', expires
)
TemporaryBlobStorage(uuid=new_uuid, file_alias=file_alias)