Opened 13 years ago

Closed 12 years ago

#2860 closed defect (wontfix)

Test client only supports file uploads with foo and foo_file parameters

Reported by: dave AT Owned by: nobody
Component: Testing framework Version: master
Severity: normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I'm using a custom manipulator with an ImageUploadField instance. This means I don't use the foo and foo_file system documented at - my field is called foo, and that's the name of the form field output in the HTML, and the name of the parameter on the network.

Unfortunately, the test client doesn't appear to support this scenario. With code like this:

f = open('/my/test/file')'/foo/bar/', { 'foo': f })

the test client transmogrifies my foo parameter into both foo and foo_file, with foo the empty string and foo_file the uploaded file itself. Sadly this is not what my manipulator is expecting, and hilarity ensues.

There's a simple workaround in the manipulator: overwrite foo with foo_file, if present. Shame it's needed though, as it's a hack to make the tests pass.

Change History (3)

comment:1 Changed 13 years ago by Russell Keith-Magee

Owner: changed from Adrian Holovaty to Russell Keith-Magee

comment:2 Changed 12 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedAccepted

comment:3 Changed 12 years ago by Russell Keith-Magee

Resolution: wontfix
Status: newclosed

This is no longer a problem with newforms and the new FileField and ImageField.

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