summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorKaren Tracey <kmtracey@gmail.com>2010-05-03 15:30:11 +0000
committerKaren Tracey <kmtracey@gmail.com>2010-05-03 15:30:11 +0000
commit7fc25715d6af20e14827c85170fff20f82ded8ab (patch)
tree2f687ad47ba0995beb08a72f017078532b50c5f5 /django/forms
parent02ffb6f1dd0bc7694247cd20a41233049464ae9d (diff)
Fixed Python2.4 incompatibility introduced in r13041: datetime.strptime classmethod was added in 2.5.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13078 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/extras/widgets.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/django/forms/extras/widgets.py b/django/forms/extras/widgets.py
index 108b2c56e2..4dabafae9e 100644
--- a/django/forms/extras/widgets.py
+++ b/django/forms/extras/widgets.py
@@ -2,6 +2,7 @@
Extra HTML Widget classes
"""
+import time
import datetime
import re
@@ -46,7 +47,11 @@ class SelectDateWidget(Widget):
if settings.USE_L10N:
try:
input_format = get_format('DATE_INPUT_FORMATS')[0]
- v = datetime.datetime.strptime(value, input_format)
+ # Python 2.4 compatibility:
+ # v = datetime.datetime.strptime(value, input_format)
+ # would be clearer, but datetime.strptime was added in
+ # Python 2.5
+ v = datetime.datetime(*(time.strptime(value, input_format)[0:6]))
year_val, month_val, day_val = v.year, v.month, v.day
except ValueError:
pass