summaryrefslogtreecommitdiff
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/regressiontests/templates/filters.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/regressiontests/templates/filters.py b/tests/regressiontests/templates/filters.py
index bd84e50c71..4d162dadee 100644
--- a/tests/regressiontests/templates/filters.py
+++ b/tests/regressiontests/templates/filters.py
@@ -317,4 +317,10 @@ def get_filter_tests():
'join02': (r'{% autoescape off %}{{ a|join:", " }}{% endautoescape %}', {'a': ['alpha', 'beta & me']}, 'alpha, beta & me'),
'join03': (r'{{ a|join:" &amp; " }}', {'a': ['alpha', 'beta & me']}, 'alpha &amp; beta &amp; me'),
'join04': (r'{% autoescape off %}{{ a|join:" &amp; " }}{% endautoescape %}', {'a': ['alpha', 'beta & me']}, 'alpha &amp; beta & me'),
+
+
+ 'date01': (r'{{ d|date:"m" }}', {'d': datetime(2008, 1, 1)}, '01'),
+ 'date02': (r'{{ d|date }}', {'d': datetime(2008, 1, 1)}, 'Jan. 1, 2008'),
+ #Ticket 9520: Make sure |date doesn't blow up on non-dates
+ 'date03': (r'{{ d|date:"m" }}', {'d': 'fail_string'}, ''),
}