你才真正需要生成包括报头的响应下载“X-AppEngine上-的BlobKey:你blob_key]”一切沿否则,如果需要,您需要像Content-Disposition标题。或者如果它是一个图像,你应该只是使用高性能图像服务api,生成一个url并重定向到它....完成
上传,除了编写一个处理程序的appengine调用一次上传是安全的Blob存储区(这是在文档)
您需要一种方法来查找传入请求的BLOB信息。我不知道瓶子里的要求是什么样子。 Blobstoreuploadhandler有一个get_uploads方法,据我所知,它没有任何理由需要成为实例方法。所以这是一个示例泛型实现,它需要一个webob请求。对于瓶子,您需要写一些与瓶子请求对象相似的东西。
def get_uploads(request, field_name=None):
"""Get uploads for this request.
Args:
field_name: Only select uploads that were sent as a specific field.
populate_post: Add the non blob fields to request.POST
Returns:
A list of BlobInfo records corresponding to each upload.
Empty list if there are no blob-info records for field_name.
stolen from the SDK since they only provide a way to get to this
crap through their crappy webapp framework
"""
if not getattr(request, "__uploads", None):
request.__uploads = {}
for key, value in request.params.items():
if isinstance(value, cgi.FieldStorage):
if 'blob-key' in value.type_options:
request.__uploads.setdefault(key, []).append(
blobstore.parse_blob_info(value))
if field_name:
try:
return list(request.__uploads[field_name])
except KeyError:
return []
else:
results = []
for uploads in request.__uploads.itervalues():
results += uploads
return results