Raise ValidationError instead of returning None if a file upload was invalid.

pull/7/head
Ferry Boender 10 years ago
parent 67cc44993a
commit 57de1bd900
  1. 5
      src/formdefinition.py

@ -227,8 +227,9 @@ class FormDefinition(object):
""" """
try: try:
value = form_values[field_def['name']] value = form_values[field_def['name']]
except KeyError: except KeyError, err:
return None raise ValidationError("Invalid file upload")
field_name = field_def['name'] field_name = field_def['name']
upload_fname = form_values[u'{0}__name'.format(field_name)] upload_fname = form_values[u'{0}__name'.format(field_name)]
upload_fname_ext = os.path.splitext(upload_fname)[-1].lstrip('.') upload_fname_ext = os.path.splitext(upload_fname)[-1].lstrip('.')

Loading…
Cancel
Save