Opened 15 years ago

Closed 15 years ago

Last modified 12 years ago

#7673 closed (fixed)

ImageField validation problem

Reported by: Luca Lenardi Owned by: Jacob
Component: Forms Version: dev
Severity: Keywords: 2070-fix
Cc: boobsd@…, justin.driscoll@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


form.cleaned_data[image_field].read() seems to be empty when validating with custom validation using newforms.

if hasattr(data, 'temporary_file_path'):
    file = data.temporary_file_path()
    if hasattr(data, 'read'):
        file = StringIO(
        file = StringIO(data['content'])
... in the clean() method of ImageField becomes empty after the first read making the file unreadable in next custom validation.

Attachments (1)

newforms_imagefix.diff (522 bytes) - added by Michael Axiak 15 years ago.
Fix for this...thanks apollo13!

Download all attachments as: .zip

Change History (9)

comment:1 Changed 15 years ago by Luca Lenardi

With custom validation, I mean implementing the clean_fieldname() method in a form using newforms.

comment:2 Changed 15 years ago by anonymous

Owner: changed from nobody to anonymous
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:3 Changed 15 years ago by Boo

Cc: boobsd@… added

comment:4 Changed 15 years ago by Michael Axiak

Has patch: set
Keywords: 2070-fix added
Owner: changed from anonymous to Michael Axiak
Status: assignednew
Triage Stage: AcceptedReady for checkin

Uploading a patch to fix this.

Changed 15 years ago by Michael Axiak

Attachment: newforms_imagefix.diff added

Fix for this...thanks apollo13!

comment:5 Changed 15 years ago by Jacob

Owner: changed from Michael Axiak to Jacob
Status: newassigned

comment:6 Changed 15 years ago by anonymous

Cc: justin.driscoll@… added

comment:7 Changed 15 years ago by Jacob

Resolution: fixed
Status: assignedclosed

(In [7907]) Fixed #7673: make sure to rewind uploaded image data when validating ImageFields. Thanks, Mike Axiak.

comment:8 Changed 12 years ago by Jacob

milestone: 1.0 beta

Milestone 1.0 beta deleted

Note: See TracTickets for help on using tickets.
Back to Top