Django

Code

Ticket #10935 (new)

Opened 11 months ago

Last modified 1 week ago

forms.ImageField.clean should annotate the object returned by FileField.clean

Reported by: jdunck Assigned to: nobody
Milestone: 1.3 Component: Forms
Version: SVN Keywords:
Cc: Triage Stage: Design decision needed
Has patch: 0 Needs documentation: 1
Needs tests: 0 Patch needs improvement: 0

Description

ImageField?.clean does some validation that the given file is, in fact, an image, but then just returns whatever the FileField? gave it-- generally an UploadedFile?.

I have a later Form.clean_* method which needs to do further work with the image, and so uses Image.open again.

I think it'd be good to annotate the UploadedFile? with an image attribute to save the work of parsing the image yet again.

f.image = trial_image

Agree?

Attachments

Change History

04/27/09 10:39:18 changed by jdunck

Also, as long as it's opening the image, I think it should correct content_type based on the actual format of the image. Most OS's will mis-report the content type of the upload based on its extension, so that a JPEG named something.gif is reported as image/gif.

12/15/09 09:47:58 changed by jcd

  • stage changed from Unreviewed to Design decision needed.

03/04/10 19:09:56 changed by jacob

  • milestone changed from 1.2 to 1.3.

I'm calling this a feature, and kicking it out of 1.2.


Add/Change #10935 (forms.ImageField.clean should annotate the object returned by FileField.clean)




Change Properties
Action