Skip to content

Commit 2b9c526

Browse files
committed
Merge branch 'v0.4' of http://github.com/schallis/mongoengine into v0.4
2 parents e9d478e + d7c4286 commit 2b9c526

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

docs/guide/gridfs.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ a document is created to store details about animals, including a photo::
2121
marmot = Animal('Marmota', 'Sciuridae')
2222

2323
marmot_photo = open('marmot.jpg', 'r') # Retrieve a photo from disk
24-
marmot.photo = marmot_photo # Store the photo in the document
24+
marmot.photo = marmot_photo # Store photo in the document
2525
marmot.photo.content_type = 'image/jpeg' # Store metadata
2626

2727
marmot.save()
@@ -40,7 +40,7 @@ Retrieval
4040
So using the :class:`~mongoengine.FileField` is just like using any other
4141
field. The file can also be retrieved just as easily::
4242

43-
marmot = Animal.objects('Marmota').first()
43+
marmot = Animal.objects(genus='Marmota').first()
4444
photo = marmot.photo.read()
4545
content_type = marmot.photo.content_type
4646

mongoengine/fields.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -614,15 +614,10 @@ def read(self):
614614
def delete(self):
615615
# Delete file from GridFS, FileField still remains
616616
self.fs.delete(self.grid_id)
617-
618-
#self.grid_id = None
619-
# Doesn't make a difference because will be put back in when
620-
# reinstantiated We should delete all the metadata stored with the
621-
# file too
617+
self.grid_id = None
622618

623619
def replace(self, file, **kwargs):
624620
self.delete()
625-
self.grid_id = None
626621
self.put(file, **kwargs)
627622

628623
def close(self):

0 commit comments

Comments
 (0)