summaryrefslogtreecommitdiff
path: root/django/forms/__init__.py
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2006-06-02 03:51:30 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2006-06-02 03:51:30 +0000
commit0c341d780ebcde0e81c81eda07e2db3aaa92549b (patch)
treea628c9bf89260dc5da569818e1ef041262de1d6a /django/forms/__init__.py
parentaeb807989f711c61b75c42241eea4c942becf19a (diff)
multi-auth: Merged to [3051]
git-svn-id: http://code.djangoproject.com/svn/django/branches/multi-auth@3052 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms/__init__.py')
-rw-r--r--django/forms/__init__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/django/forms/__init__.py b/django/forms/__init__.py
index 7ad26a4d71..b67e1d0f84 100644
--- a/django/forms/__init__.py
+++ b/django/forms/__init__.py
@@ -577,7 +577,7 @@ class SelectMultipleField(SelectField):
selected_html = ''
if str(value) in str_data_list:
selected_html = ' selected="selected"'
- output.append(' <option value="%s"%s>%s</option>' % (escape(value), selected_html, choice))
+ output.append(' <option value="%s"%s>%s</option>' % (escape(value), selected_html, escape(choice)))
output.append(' </select>')
return '\n'.join(output)
@@ -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):