Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Claude Paroz authored April 05, 2012

Showing 1 changed file with 1 addition and 12 deletions. Show diff stats Hide diff stats

  1. 13  django/forms/fields.py
13  django/forms/fields.py
@@ -341,18 +341,7 @@ def to_python(self, value):
341 341
                 try:
342 342
                     return self.strptime(value, format)
343 343
                 except ValueError:
344  
-                    if format.endswith('.%f'):
345  
-                        # Compatibility with datetime in pythons < 2.6.
346  
-                        # See: http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior
347  
-                        if value.count('.') != format.count('.'):
348  
-                            continue
349  
-                        try:
350  
-                            datetime_str, usecs_str = value.rsplit('.', 1)
351  
-                            usecs = int(usecs_str[:6].ljust(6, '0'))
352  
-                            dt = datetime.datetime.strptime(datetime_str, format[:-3])
353  
-                            return dt.replace(microsecond=usecs)
354  
-                        except ValueError:
355  
-                            continue
  344
+                    continue
356 345
         raise ValidationError(self.error_messages['invalid'])
357 346
 
358 347
     def strptime(self, value, format):

0 notes on commit 5e047ed

Please sign in to comment.
Something went wrong with that request. Please try again.