コード例 #1
0
 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)
コード例 #2
0
ファイル: storage.py プロジェクト: olibrook/djangae
 def __init__(self, blobinfo, charset):
     super(BlobstoreUploadedFile,
           self).__init__(BlobReader(blobinfo.key()), blobinfo.filename,
                          blobinfo.content_type, blobinfo.size, charset)
     self.blobstore_info = blobinfo
コード例 #3
0
ファイル: storage.py プロジェクト: olibrook/djangae
 def file(self):
     if not hasattr(self, '_file'):
         self._file = BlobReader(self.blobstore_info.key())
     return self._file
コード例 #4
0
 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