mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-04-01 04:20:23 +00:00
Fix loopy existence check
Sometimes two wrongs do make a right I guess. But better to have two rights.
This commit is contained in:
parent
f181d30008
commit
ac92b77709
1 changed files with 2 additions and 5 deletions
|
|
@ -38,7 +38,7 @@ class CachedFileBackend(object):
|
|||
return exists
|
||||
|
||||
def ensure_exists(self, file):
|
||||
if self.exists(file):
|
||||
if not self.exists(file):
|
||||
self.create(file)
|
||||
self.cache.set(self.get_key(file), True)
|
||||
|
||||
|
|
@ -51,10 +51,7 @@ class Simple(CachedFileBackend):
|
|||
"""
|
||||
|
||||
def _exists(self, file):
|
||||
if not getattr(file, '_file', None):
|
||||
# No file on object. Have to check storage.
|
||||
return not file.storage.exists(file.name)
|
||||
return False
|
||||
return getattr(file, '_file', None) or file.storage.exists(file.name)
|
||||
|
||||
def create(self, file):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue