Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageField is nullified after save #847

Closed
lmanzurv opened this issue Jan 10, 2015 · 3 comments
Closed

ImageField is nullified after save #847

lmanzurv opened this issue Jan 10, 2015 · 3 comments
Labels

Comments

@lmanzurv
Copy link

When I fetch a document with an ImageField, the image can be read using doc.image.read(), but if I do a doc.save() and then I do a doc.image.read(), the image is empty

@jcodebrain
Copy link

Same Issue here : #1387

@jcodebrain
Copy link

same issue here

@bagerard
Copy link
Collaborator

I believe the problem is not the .save() but the .read(). As it's a file-like object, when you call .read() you are moving the cursor to the end of the file. If you then call .read() without "rewinding" it, you get None because there is nothing to read anymore. This is also the case with the underlying pymongo GridFS/GridOut structure so its not really a bug, you need to call .seek(0) if you want to read() it multiple times. The doc was improved to reflect this in #2229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants