1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #1443 -- Django's various bits now support dates before 1900. Thanks to SmileyChris, Chris Green, Fredrik Lundh and others for patches and design help

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7946 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2008-07-18 03:47:27 +00:00
parent f6fafc02c8
commit df2b19cc17
9 changed files with 162 additions and 19 deletions

View File

@@ -141,10 +141,6 @@ def _isValidDate(date_string):
# Could use time.strptime here and catch errors, but datetime.date below
# produces much friendlier error messages.
year, month, day = map(int, date_string.split('-'))
# This check is needed because strftime is used when saving the date
# value to the database, and strftime requires that the year be >=1900.
if year < 1900:
raise ValidationError, _('Year must be 1900 or later.')
try:
date(year, month, day)
except ValueError, e:
@@ -407,12 +403,12 @@ class IsAPowerOf(object):
"""
Usage: If you create an instance of the IsPowerOf validator:
v = IsAPowerOf(2)
The following calls will succeed:
v(4, None)
v(4, None)
v(8, None)
v(16, None)
But this call:
v(17, None)
will raise "django.core.validators.ValidationError: ['This value must be a power of 2.']"