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 /django/template | |
| 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 'django/template')
| -rw-r--r-- | django/template/__init__.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/django/template/__init__.py b/django/template/__init__.py index 5c4ab3052a..ffdb4e4809 100644 --- a/django/template/__init__.py +++ b/django/template/__init__.py @@ -485,9 +485,14 @@ class FilterExpression(object): (token[:upto], token[upto:start], token[start:])) if var == None: var, constant, i18n_constant = match.group("var", "constant", "i18n_constant") - if i18n_constant: - var = '"%s"' % _(i18n_constant.replace(r'\"', '"')) - elif constant: + if i18n_constant is not None: + # Don't pass the empty string to gettext, because the empty + # string translates to meta information. + if i18n_constant == "": + var = '""' + else: + var = '"%s"' % _(i18n_constant.replace(r'\"', '"')) + elif constant is not None: var = '"%s"' % constant.replace(r'\"', '"') upto = match.end() if var == None: |
