From cfa3d01f5498e9a7a654df8f4df115b95e65d354 Mon Sep 17 00:00:00 2001 From: Matthew Tretter Date: Mon, 7 Nov 2011 23:01:52 -0500 Subject: [PATCH] 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. --- imagekit/management/commands/ikflush.py | 2 +- imagekit/models.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/imagekit/management/commands/ikflush.py b/imagekit/management/commands/ikflush.py index d718992..de140f1 100644 --- a/imagekit/management/commands/ikflush.py +++ b/imagekit/management/commands/ikflush.py @@ -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' diff --git a/imagekit/models.py b/imagekit/models.py index 8ca7871..5297ab2 100755 --- a/imagekit/models.py +++ b/imagekit/models.py @@ -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):