Merge pull request #469 from jyapayne/master

Fixes AttributeError when using storage.exists() on a non-existing file.
This commit is contained in:
Ross Lawley 2013-09-27 08:21:49 -07:00
commit 6f808bd06e

View File

@ -76,7 +76,7 @@ class GridFSStorage(Storage):
"""Find the documents in the store with the given name
"""
docs = self.document.objects
doc = [d for d in docs if getattr(d, self.field).name == name]
doc = [d for d in docs if hasattr(getattr(d, self.field), 'name') and getattr(d, self.field).name == name]
if doc:
return doc[0]
else: