mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-23 08:20:25 +00:00
Add __nonzero__ method that will work for async
This commit is contained in:
parent
fc87c0497c
commit
c48c720f8a
1 changed files with 9 additions and 0 deletions
|
|
@ -75,6 +75,15 @@ class ImageCacheFile(BaseIKFile, ImageFile):
|
|||
)
|
||||
)
|
||||
|
||||
def __nonzero__(self):
|
||||
if not self.name:
|
||||
return False
|
||||
|
||||
# Dispatch the before_access signal before checking to see if the file
|
||||
# exists. This gives the strategy a chance to create the file.
|
||||
before_access.send(sender=self, file=self)
|
||||
return self.cachefile_backend.exists(self)
|
||||
|
||||
|
||||
class LazyImageCacheFile(LazyObject):
|
||||
def __init__(self, generator_id, *args, **kwargs):
|
||||
|
|
|
|||
Loading…
Reference in a new issue