Ticket #9979: fields.diff
File fields.diff, 1.4 KB (added by , 16 years ago) |
---|
-
django/forms/fields.py
25 25 26 26 import django.core.exceptions 27 27 from django.utils.translation import ugettext_lazy as _ 28 from django.utils.encoding import smart_unicode, smart_str 28 from django.utils.encoding import smart_unicode, smart_str, force_unicode 29 29 30 30 from util import ErrorList, ValidationError 31 31 from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateTimeInput, TimeInput, SplitDateTimeWidget, SplitHiddenDateTimeWidget … … 305 305 return value 306 306 for format in self.input_formats: 307 307 try: 308 return datetime.date(*time.strptime(value, for mat)[:3])308 return datetime.date(*time.strptime(value, force_unicode(format))[:3]) 309 309 except ValueError: 310 310 continue 311 311 raise ValidationError(self.error_messages['invalid']) … … 337 337 return value 338 338 for format in self.input_formats: 339 339 try: 340 return datetime.time(*time.strptime(value, for mat)[3:6])340 return datetime.time(*time.strptime(value, force_unicode(format))[3:6]) 341 341 except ValueError: 342 342 continue 343 343 raise ValidationError(self.error_messages['invalid'])