def image2blob(image, filename, content_type): blobfile = NyBlobFile(filename=filename, content_type=content_type) bf_stream = blobfile.open_write() # data = image.data # bf_stream.write(data) bf_stream.write(image) bf_stream.close() blobfile.size = len(image) return blobfile
def make_blobfile(self, filename='bf.txt', content='hello world', content_type='text/plain'): bf = NyBlobFile( filename=filename, content_type=content_type, timestamp=datetime.utcnow(), contributor='tester') bf.removed = False bf.size = len(content) f = bf.open_write() f.write(content) f.close() return bf
def make_blobfile(self, filename='bf.txt', content='hello world', content_type='text/plain'): bf = NyBlobFile(filename=filename, content_type=content_type, timestamp=datetime.utcnow(), contributor='tester') bf.removed = False bf.size = len(content) f = bf.open_write() f.write(content) f.close() return bf