class ViewPhotoHandler(blobstore_handlers.BlobstoreDownloadHandler):
def get(self, photo_key):
profile_id = string.strip( string_after( self.request.path,"/view_photo/") )
logging.info("ViewPhotoHandler profile_id=%s" % profile_id)
user=None
blob_keys=[]
if profile_id:
user = User.get_by_id( long( profile_id ))
blob_keys=user.blob_keys
logging.info("ViewPhotoHandler blob_keys %s "%blob_keys)
self.response.headers['Content-Type']="plain/text"
for photo_key in blob_keys:
blob_info = blobstore.get(photo_key)
logging.info("ViewPhotoHandler photo_key %s blob_info %s " % (photo_key,blob_info))
if blob_info:
self.send_blob(blob_info)
此代码适用于一张但不适用于两张照片。我在日志中得到了正确的密钥。
当我发送两个它抱怨
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\webapp\blobstore_handlers.py", line 298, in send_blob
del self.response.headers['Content-Type']
send_blob
引擎盖下到底做了什么?