mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-17 05:40:25 +00:00
Validate the image any time the file is required
This means that accessing `path` or `size` will also validate, closing #109
This commit is contained in:
parent
24a2d772a6
commit
3a5d7da0d8
1 changed files with 2 additions and 11 deletions
|
|
@ -36,12 +36,8 @@ class ImageSpecFieldFile(ImageFieldFile):
|
|||
def _require_file(self):
|
||||
if not self.source_file:
|
||||
raise ValueError("The '%s' attribute's image_field has no file associated with it." % self.attname)
|
||||
|
||||
def _get_file(self):
|
||||
self.validate()
|
||||
return super(ImageFieldFile, self).file
|
||||
|
||||
file = property(_get_file, ImageFieldFile._set_file, ImageFieldFile._del_file)
|
||||
else:
|
||||
self.validate()
|
||||
|
||||
def clear(self):
|
||||
return self.field.image_cache_backend.clear(self)
|
||||
|
|
@ -61,11 +57,6 @@ class ImageSpecFieldFile(ImageFieldFile):
|
|||
return self.field.generator.generate_file(self.name, self.source_file,
|
||||
save)
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
self.validate()
|
||||
return super(ImageFieldFile, self).url
|
||||
|
||||
def delete(self, save=False):
|
||||
"""
|
||||
Pulled almost verbatim from ``ImageFieldFile.delete()`` and
|
||||
|
|
|
|||
Loading…
Reference in a new issue