diff options
| author | Gary Wilson Jr <gary.wilson@gmail.com> | 2008-08-15 21:08:11 +0000 |
|---|---|---|
| committer | Gary Wilson Jr <gary.wilson@gmail.com> | 2008-08-15 21:08:11 +0000 |
| commit | 6d863fef8a992ef28b081e9fa6043e4a9799e965 (patch) | |
| tree | 271d5541f009977fdec99ce17e4b0d49cd17f779 /tests/regressiontests | |
| parent | 0ca738363afafacf1a82c978b2a2d1e00d9495a8 (diff) | |
Fixed #5270 -- Allow template tags and filters to accept an emtpy string, patch from jdunck.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8393 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/templates/tests.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py index 13b8c6b488..96e1d662c6 100644 --- a/tests/regressiontests/templates/tests.py +++ b/tests/regressiontests/templates/tests.py @@ -365,6 +365,9 @@ class Templates(unittest.TestCase): # Numbers as filter arguments should work 'filter-syntax19': ('{{ var|truncatewords:1 }}', {"var": "hello world"}, "hello ..."), + + #filters should accept empty string constants + 'filter-syntax20': ('{{ ""|default_if_none:"was none" }}', {}, ""), ### COMMENT SYNTAX ######################################################## 'comment-syntax01': ("{# this is hidden #}hello", {}, "hello"), @@ -770,11 +773,12 @@ class Templates(unittest.TestCase): 'i18n14': ('{% cycle "foo" _("Password") _(\'Password\') as c %} {% cycle c %} {% cycle c %}', {'LANGUAGE_CODE': 'de'}, 'foo Passwort Passwort'), 'i18n15': ('{{ absent|default:_("Password") }}', {'LANGUAGE_CODE': 'de', 'absent': ""}, 'Passwort'), 'i18n16': ('{{ _("<") }}', {'LANGUAGE_CODE': 'de'}, '<'), + 'i18n17': ('{{ _("") }}', {'LANGUAGE_CODE': 'de'}, ''), # Escaping inside blocktrans works as if it was directly in the # template. - 'i18n17': ('{% load i18n %}{% blocktrans with anton|escape as berta %}{{ berta }}{% endblocktrans %}', {'anton': 'α & β'}, u'α & β'), - 'i18n18': ('{% load i18n %}{% blocktrans with anton|force_escape as berta %}{{ berta }}{% endblocktrans %}', {'anton': 'α & β'}, u'α & β'), + 'i18n18': ('{% load i18n %}{% blocktrans with anton|escape as berta %}{{ berta }}{% endblocktrans %}', {'anton': 'α & β'}, u'α & β'), + 'i18n19': ('{% load i18n %}{% blocktrans with anton|force_escape as berta %}{{ berta }}{% endblocktrans %}', {'anton': 'α & β'}, u'α & β'), ### HANDLING OF TEMPLATE_STRING_IF_INVALID ################################### |
