Skip to content

Bug with image thumbnailing #1

@blanchardjeremy

Description

@blanchardjeremy

In fields.py

        if not self.__dict__.has_key(attribute):
            # Proceed to thumbnail generation only if a *thumbnail* attribute
            # is requested
            if self.field.thumbnails.has_key(attribute):
                # Generate thumbnail
                self._require_file()    # TODO: document this
                if self._verify_thumbnail_requirements():
                    proc_opts = self.field.thumbnails[attribute]
                    t = ThumbnailFieldFile(self.instance, self.field, self, self.name, attribute, proc_opts)
                    t.save()
                    assert self.__dict__[attribute] == t, \
                        Exception('Thumbnail attribute `%s` not set' % attribute)
            else:
                return super(BaseEnhancedImageFieldFile, self).__getattr__(attribute)
        return self.__dict__[attribute]

I'm getting a condition where if self._verify_thumbnail_requirements() is false and then it pops down to self.__dict__[attribute] which throws an error.

I think there should be some logic to account for this.

Unfortunately, I wasn't able to figure out exactly how I got my field/thumbnail into this state. I imagine that's not too helpful. The only steps I remember doing was having an image, editing that model and uploading a new image, and pressing save. My form had an error so I was being redirected back to the form. I guess it could be form some in-between state that the field is in? I'm not sure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions