summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-04-02 05:20:25 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-04-02 05:20:25 +0000
commit9828557731072ccc5734bed520d6efcde620dc1d (patch)
tree4e86b5a07b5cec1648807eb699be37d4112c64eb /django
parentef9bedf8153f921e3a4a6c131dd0334bfb8198e9 (diff)
Fixed #9520: make the date filter fail silently for non-date values. Thanks, Andrew Badr and Eric Holscher.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10365 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/template/defaultfilters.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py
index 673d044e5b..7db6715b49 100644
--- a/django/template/defaultfilters.py
+++ b/django/template/defaultfilters.py
@@ -681,7 +681,10 @@ def date(value, arg=None):
return u''
if arg is None:
arg = settings.DATE_FORMAT
- return format(value, arg)
+ try:
+ return format(value, arg)
+ except AttributeError:
+ return ''
date.is_safe = False
def time(value, arg=None):
@@ -691,7 +694,10 @@ def time(value, arg=None):
return u''
if arg is None:
arg = settings.TIME_FORMAT
- return time_format(value, arg)
+ try:
+ return time_format(value, arg)
+ except AttributeError:
+ return ''
time.is_safe = False
def timesince(value, arg=None):