mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-17 05:40:25 +00:00
Rename _create() to generate()
After #51 presented a good use case, we decided to make this part of the API (i.e. remove the underscore). The default value for the `lazy` kwarg is changed to `True` to reduce the likelihood of accidental regeneration of images. Closes #54.
This commit is contained in:
parent
8c9a9b8d5c
commit
cfa3d01f54
2 changed files with 6 additions and 6 deletions
|
|
@ -30,6 +30,6 @@ def flush_cache(apps, options):
|
|||
if spec_file is not None:
|
||||
spec_file.delete(save=False)
|
||||
if spec_file.field.pre_cache:
|
||||
spec_file._create()
|
||||
spec_file.generate(False)
|
||||
else:
|
||||
print 'Please specify one or more app names'
|
||||
|
|
|
|||
|
|
@ -168,19 +168,19 @@ class ImageSpecFile(_ImageSpecFileMixin, ImageFieldFile):
|
|||
raise ValueError("The '%s' attribute's image_field has no file associated with it." % self.attname)
|
||||
|
||||
def _get_file(self):
|
||||
self._create(True)
|
||||
self.generate()
|
||||
return super(ImageFieldFile, self).file
|
||||
|
||||
file = property(_get_file, ImageFieldFile._set_file, ImageFieldFile._del_file)
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
self._create(True)
|
||||
self.generate()
|
||||
return super(ImageFieldFile, self).url
|
||||
|
||||
def _create(self, lazy=False):
|
||||
def generate(self, lazy=True):
|
||||
"""
|
||||
Creates a new image by running the processors on the source file.
|
||||
Generates a new image by running the processors on the source file.
|
||||
|
||||
Keyword Arguments:
|
||||
lazy -- True if an already-existing image should be returned;
|
||||
|
|
@ -330,7 +330,7 @@ def _post_save_handler(sender, instance=None, created=False, raw=False, **kwargs
|
|||
if not created:
|
||||
spec_file.delete(save=False)
|
||||
if spec_file.field.pre_cache:
|
||||
spec_file._create()
|
||||
spec_file.generate(False)
|
||||
|
||||
|
||||
def _post_delete_handler(sender, instance=None, **kwargs):
|
||||
|
|
|
|||
Loading…
Reference in a new issue