mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-16 21:30:23 +00:00
Fix bug
Eric's fixes in c00ea10b0a 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.
This commit is contained in:
parent
c00ea10b0a
commit
51144daeb6
1 changed files with 2 additions and 5 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue