Ticket #9979: fields.diff

File fields.diff, 1.4 KB (added by matehat, 16 years ago)

Patch for the django/forms/fields.py file

  • django/forms/fields.py

     
    2525
    2626import django.core.exceptions
    2727from django.utils.translation import ugettext_lazy as _
    28 from django.utils.encoding import smart_unicode, smart_str
     28from django.utils.encoding import smart_unicode, smart_str, force_unicode
    2929
    3030from util import ErrorList, ValidationError
    3131from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateTimeInput, TimeInput, SplitDateTimeWidget, SplitHiddenDateTimeWidget
     
    305305            return value
    306306        for format in self.input_formats:
    307307            try:
    308                 return datetime.date(*time.strptime(value, format)[:3])
     308                return datetime.date(*time.strptime(value, force_unicode(format))[:3])
    309309            except ValueError:
    310310                continue
    311311        raise ValidationError(self.error_messages['invalid'])
     
    337337            return value
    338338        for format in self.input_formats:
    339339            try:
    340                 return datetime.time(*time.strptime(value, format)[3:6])
     340                return datetime.time(*time.strptime(value, force_unicode(format))[3:6])
    341341            except ValueError:
    342342                continue
    343343        raise ValidationError(self.error_messages['invalid'])
Back to Top