summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-04-02 05:22:17 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-04-02 05:22:17 +0000
commit4257feffe8af5f31c0e851754db802ce7a8a0912 (patch)
tree338882aac425c945ec6db55aa1e0be1aaaa6fcd0 /django
parent38aeee4839f273b0575dbbb605303e27c3f87da8 (diff)
[1.0.X] Fixed #9520: make the date filter fail silently for non-date values. Thanks, Andrew Badr and Eric Holscher. Backport of r10365 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10366 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 a0010003b1..01961a338f 100644
--- a/django/template/defaultfilters.py
+++ b/django/template/defaultfilters.py
@@ -673,7 +673,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):
@@ -683,7 +686,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):