Merge ~cjwatson/launchpad:temporaryblobmanager-new-bytes into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 17f50638f82e8931165e906d5726f8761806b24b
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:temporaryblobmanager-new-bytes
Merge into: launchpad:master
Diff against target: 36 lines (+3/-3)
2 files modified
lib/lp/bugs/tests/test_apportjob.py (+1/-1)
lib/lp/services/temporaryblobstorage/model.py (+2/-2)
Reviewer Review Type Date Requested Status
Tom Wardill (community) Approve
Review via email: mp+379996@code.launchpad.net

Commit message

Make TemporaryBlobManager.new take blob as bytes

To post a comment you must log in.
Revision history for this message
Tom Wardill (twom) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/bugs/tests/test_apportjob.py b/lib/lp/bugs/tests/test_apportjob.py
2index 076ac2f..c0b4799 100644
3--- a/lib/lp/bugs/tests/test_apportjob.py
4+++ b/lib/lp/bugs/tests/test_apportjob.py
5@@ -342,7 +342,7 @@ class TestTemporaryBlobStorageAddView(TestCaseWithFactory):
6 # Create a BLOB using existing testing data.
7 testfiles = os.path.join(config.root, 'lib/lp/bugs/tests/testfiles')
8 blob_file = open(
9- os.path.join(testfiles, 'extra_filebug_data.msg'))
10+ os.path.join(testfiles, 'extra_filebug_data.msg'), 'rb')
11 self.blob_data = blob_file.read()
12 blob_file.close()
13
14diff --git a/lib/lp/services/temporaryblobstorage/model.py b/lib/lp/services/temporaryblobstorage/model.py
15index 287b002..b4e42e8 100644
16--- a/lib/lp/services/temporaryblobstorage/model.py
17+++ b/lib/lp/services/temporaryblobstorage/model.py
18@@ -9,8 +9,8 @@ __all__ = [
19 ]
20
21
22-from cStringIO import StringIO
23 from datetime import timedelta
24+from io import BytesIO
25 import uuid
26
27 from sqlobject import (
28@@ -124,7 +124,7 @@ class TemporaryStorageManager:
29 secret = str(uuid.uuid1())
30
31 file_alias = getUtility(ILibraryFileAliasSet).create(
32- secret, len(blob), StringIO(blob),
33+ secret, len(blob), BytesIO(blob),
34 'application/octet-stream', expires
35 )
36 TemporaryBlobStorage(uuid=new_uuid, file_alias=file_alias)

Subscribers

People subscribed via source and target branches

to status/vote changes: