mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #2045 - TypeError thrown if a form does not have the correct enctype for uploading
files. It throws a ValidationError now, as it should. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3048 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -641,7 +641,11 @@ class FileUploadField(FormField):
|
||||
self.validator_list = [self.isNonEmptyFile] + validator_list
|
||||
|
||||
def isNonEmptyFile(self, field_data, all_data):
|
||||
if not field_data['content']:
|
||||
try:
|
||||
content = field_data['content']
|
||||
except TypeError:
|
||||
raise validators.CriticalValidationError, gettext("No file was submitted. Check the encoding type on the form.")
|
||||
if not content:
|
||||
raise validators.CriticalValidationError, gettext("The submitted file is empty.")
|
||||
|
||||
def render(self, data):
|
||||
|
||||
Reference in New Issue
Block a user