From 92a6c1429162d132a00c8b06efc960ba1d2dcc3e Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Fri, 24 Oct 2008 07:14:30 +0000 Subject: Fixed #9384 -- Fixed a couple of typos. Thanks, Thomas Güttler and romke. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://code.djangoproject.com/svn/django/trunk@9255 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/forms/fields.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'django/forms') diff --git a/django/forms/fields.py b/django/forms/fields.py index b20beb939f..2420e2050a 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -667,7 +667,7 @@ class TypedChoiceField(ChoiceField): self.coerce = kwargs.pop('coerce', lambda val: val) self.empty_value = kwargs.pop('empty_value', '') super(TypedChoiceField, self).__init__(*args, **kwargs) - + def clean(self, value): """ Validate that the value is in self.choices and can be coerced to the @@ -676,12 +676,12 @@ class TypedChoiceField(ChoiceField): value = super(TypedChoiceField, self).clean(value) if value == self.empty_value or value in EMPTY_VALUES: return self.empty_value - + # Hack alert: This field is purpose-made to use with Field.to_python as # a coercion function so that ModelForms with choices work. However, - # Django's Field.to_python raises django.core.exceptions.ValidationError, - # which is a *different* exception than - # django.forms.utils.ValidationError. So unfortunatly we need to catch + # Django's Field.to_python raises + # django.core.exceptions.ValidationError, which is a *different* + # exception than django.forms.util.ValidationError. So we need to catch # both. try: value = self.coerce(value) -- cgit v1.3