Add bucket_name parameter to blob
This was introduced in the 1.7.5 SDK.
@@ -369,6 +369,10 @@ class UploadCGIHandler(object):
headers['Content-Length'] = str(content_length)
headers[blobstore.UPLOAD_INFO_CREATION_HEADER] = (
blobstore._format_creation(creation))
+ if bucket_name:
+ headers[blobstore.CLOUD_STORAGE_OBJECT_HEADER] = (
+ '/gs/%s/fake-%s-%s' % (bucket_name, blob_entity.key().name(),
+ blob_key))
headers['Content-MD5'] = blob_key
for key, value in headers.iteritems():
external.add_header(key, value)
@@ -420,7 +424,9 @@ class UploadCGIHandler(object):
Returns:
A string rendering of a MIMEMultipart instance.
"""
- message = self._GenerateMIMEMessage(form, boundary=boundary)
+ message = self._GenerateMIMEMessage(form,
+ boundary=boundary,
+ bucket_name=bucket_name)
message_out = cStringIO.StringIO()
gen = generator.Generator(message_out, maxheaderlen=0)
gen.flatten(message, unixfrom=False)
