Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed pre-2.6 compatibility code in date-based form fields. Refs #9…

…459.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17870 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5e047ed859251d8019a185262b8f5abf5966af09 1 parent 38115ea
@claudep claudep authored
Showing with 1 addition and 12 deletions.
  1. +1 −12 django/forms/fields.py
View
13 django/forms/fields.py
@@ -341,18 +341,7 @@ def to_python(self, value):
try:
return self.strptime(value, format)
except ValueError:
- if format.endswith('.%f'):
- # Compatibility with datetime in pythons < 2.6.
- # See: http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior
- if value.count('.') != format.count('.'):
- continue
- try:
- datetime_str, usecs_str = value.rsplit('.', 1)
- usecs = int(usecs_str[:6].ljust(6, '0'))
- dt = datetime.datetime.strptime(datetime_str, format[:-3])
- return dt.replace(microsecond=usecs)
- except ValueError:
- continue
+ continue
raise ValidationError(self.error_messages['invalid'])
def strptime(self, value, format):
Please sign in to comment.
Something went wrong with that request. Please try again.