From 51144daeb6cdafe99211108327f8ca9a14ca1eb0 Mon Sep 17 00:00:00 2001 From: Matthew Tretter Date: Sun, 25 Sep 2011 16:18:52 -0400 Subject: [PATCH] Fix bug Eric's fixes in c00ea10b0a700e69003b860b5dbcc337d7b00e4d meant that some of the code that already existed to reuse objects would actually be run for the first time. Naturally, there were some bugs; namely, I was storing a filename (instead of a File object) in `_file` and a bad else clause. --- imagekit/models.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/imagekit/models.py b/imagekit/models.py index 03997ce..bf6007b 100755 --- a/imagekit/models.py +++ b/imagekit/models.py @@ -139,7 +139,7 @@ class ImageSpecFile(_ImageSpecFileMixin): img = self._img if not img and self.storage.exists(self.name): img = open_image(self.file) - if not img and self.source_file: + if not img and self.source_file: # TODO: Should we error here or something if the source_file doesn't exist? # Process the original image file try: fp = self.source_file.storage.open(self.source_file.name) @@ -149,10 +149,7 @@ class ImageSpecFile(_ImageSpecFileMixin): fp = StringIO(fp.read()) img, content = self._process_content(self.name, fp) - self._file = self.storage.save(self.name, content) - else: - # TODO: Should we error here or something if the imagefield doesn't exist? - img = None + self.storage.save(self.name, content) self._img = img return self._img