save data as binary

This commit is contained in:
Mike Dirolf 2009-01-26 17:59:45 -05:00
parent 8884499512
commit 25dd339219

View File

@ -21,6 +21,7 @@ from pymongo.son import SON
from pymongo.database import Database
from pymongo.objectid import ObjectId
from pymongo.dbref import DBRef
from pymongo.binary import Binary
from errors import CorruptGridFile
class GridFile(object):
@ -152,6 +153,7 @@ class GridFile(object):
__chunks_collection = "_chunks"
def __write_current_chunk(self):
# TODO _chunks collection should be configurable?
self.__current_chunk["data"] = Binary(self.__current_chunk["data"])
self.__collection.database()[self.__chunks_collection].save(self.__current_chunk)
def flush(self):