django.forms FileField does not allow empty files.
The FileField.clean() method raises ValidationError if the uploaded file is empty.
While this is useful in many cases, there are times when it is useful to allow empty files. Since the check is mixed in with the other validation checks, it isn't very easy to disable the check in a subclass without reimplementing the entire clean() method.
It would be nice if FileField could be directly configured to disable the empty check.
Component: |
Uncategorized → File uploads/storage
|
milestone: |
→ 1.3
|
Needs documentation: |
set
|
Needs tests: |
set
|
Owner: |
changed from nobody to Sasha Romijn
|
Status: |
new → assigned
|
Triage Stage: |
Unreviewed → Accepted
|
Version: |
1.1 → SVN
|
Has patch: |
set
|
Needs documentation: |
unset
|
Needs tests: |
unset
|
Owner: |
changed from Sasha Romijn to nobody
|
Status: |
assigned → new
|
Owner: |
changed from nobody to Flaviu Simihaian
|
Triage Stage: |
Accepted → Ready for checkin
|
Severity: |
→ Normal
|
Type: |
→ Bug
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
I've been asked offline why I called the parameter allow_empty_file.
The consideration for this is to have a clear distinction between "must you upload a file, for the form validation to succeed" and "must the file be greater than 0 bytes". By calling it "blank", as suggested, for me this would feel like the former, where allow_empty file clearly refers to the latter.