Skip to content

Commit db4c04c

Browse files
achawkinsdcrosta
authored andcommitted
Added _id return from save_file and kwargs to be stored in the document
1 parent 3815e0f commit db4c04c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

flask_pymongo/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def get_upload(filename):
214214
response.make_conditional(request)
215215
return response
216216

217-
def save_file(self, filename, fileobj, base="fs", content_type=None):
217+
def save_file(self, filename, fileobj, base="fs", content_type=None, **kwargs):
218218
"""Save a file-like object to GridFS using the given filename.
219219
220220
.. code-block:: python
@@ -240,4 +240,4 @@ def save_upload(filename):
240240
content_type, _ = guess_type(filename)
241241

242242
storage = GridFS(self.db, base)
243-
storage.put(fileobj, filename=filename, content_type=content_type)
243+
return storage.put(fileobj, filename=filename, content_type=content_type, **kwargs)

0 commit comments

Comments
 (0)