Add __nonzero__ method that will work for async

This commit is contained in:
Matthew Tretter 2013-03-15 00:27:23 -04:00
parent fc87c0497c
commit c48c720f8a

View file

@ -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):