Created
May 11, 2012 20:59
-
-
Save Kronuz/2662379 to your computer and use it in GitHub Desktop.
...ImageSpecFieldFile error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/apps-ext/imagekit/models/fields/files.py b/apps-ext/imagekit/models/fields/files.py | |
index e206377..e98b7d9 100755 | |
--- a/apps-ext/imagekit/models/fields/files.py | |
+++ b/apps-ext/imagekit/models/fields/files.py | |
@@ -111,7 +111,9 @@ class ImageSpecFieldFile(ImageFieldFile): | |
""" | |
name = getattr(self, '_name', None) | |
if not name: | |
- filename = self.source_file.name | |
+ filename = self.__dict__.get('name') | |
+ if not filename: | |
+ filename = self.source_file.name | |
new_filename = None | |
if filename: | |
cache_to = self.field.cache_to or self._default_cache_to | |
@@ -121,11 +123,11 @@ class ImageSpecFieldFile(ImageFieldFile): | |
' specified') | |
if callable(cache_to): | |
suggested_extension = suggest_extension( | |
- self.source_file.name, self.field.generator.format) | |
+ filename, self.field.generator.format) | |
new_filename = force_unicode( | |
datetime.datetime.now().strftime( | |
smart_str(cache_to(self.instance, | |
- self.source_file.name, self.attname, | |
+ filename, self.attname, | |
suggested_extension)))) | |
else: | |
dir_name = os.path.normpath( | |
@@ -143,7 +145,7 @@ class ImageSpecFieldFile(ImageFieldFile): | |
# to allow anybody to set the name, but ``File.__init__`` (which is | |
# called by ``ImageSpecFieldFile.__init__``) does, so we have to allow | |
# it at least that one time. | |
- pass | |
+ self._name = value | |
class ProcessedImageFieldFile(ImageFieldFile): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment