def serve(self, filename): #TODO: Surely if this file is served from a hash-based URL then we #can return HTTP caching headers, right? info = BlobInfo.all().filter('filename = ', filename).get() if not info: return HttpResponseNotFound() # content = BlobReader(info.key()).read() return HttpResponse(content, mimetype=info.content_type)
def __init__(self, blobinfo, charset): super(BlobstoreUploadedFile, self).__init__(BlobReader(blobinfo.key()), blobinfo.filename, blobinfo.content_type, blobinfo.size, charset) self.blobstore_info = blobinfo
def file(self): if not hasattr(self, '_file'): self._file = BlobReader(self.blobstore_info.key()) return self._file
def __init__(self, blobinfo, charset): logger.info('BlobstoreUploadedFile.__init__ %s', blobinfo.content_type) super(BlobstoreUploadedFile, self).__init__( BlobReader(blobinfo.key()), # read only file-like interface to blob blobinfo.filename, blobinfo.content_type, blobinfo.size, charset) self.blobstore_info = blobinfo