1
0
mirror of https://github.com/django/django.git synced 2025-10-31 01:25:32 +00:00

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
This commit is contained in:
Gary Wilson Jr
2008-08-15 21:08:11 +00:00
parent 0ca738363a
commit 6d863fef8a
2 changed files with 14 additions and 5 deletions

View File

@@ -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: