Fixed #29931 -- Removed unused ValueError handling in naturalday template tag.
This commit is contained in:
parent
9b110f0a84
commit
f62cf22c48
|
@ -187,15 +187,12 @@ def naturalday(value, arg=None):
|
||||||
present day return representing string. Otherwise, return a string
|
present day return representing string. Otherwise, return a string
|
||||||
formatted according to settings.DATE_FORMAT.
|
formatted according to settings.DATE_FORMAT.
|
||||||
"""
|
"""
|
||||||
try:
|
|
||||||
tzinfo = getattr(value, 'tzinfo', None)
|
tzinfo = getattr(value, 'tzinfo', None)
|
||||||
|
try:
|
||||||
value = date(value.year, value.month, value.day)
|
value = date(value.year, value.month, value.day)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# Passed value wasn't a date object
|
# Passed value wasn't a date object
|
||||||
return value
|
return value
|
||||||
except ValueError:
|
|
||||||
# Date arguments out of range
|
|
||||||
return value
|
|
||||||
today = datetime.now(tzinfo).date()
|
today = datetime.now(tzinfo).date()
|
||||||
delta = value - today
|
delta = value - today
|
||||||
if delta.days == 0:
|
if delta.days == 0:
|
||||||
|
|
Loading…
Reference in New Issue