Strip spaces off of function names before looking them up. They shouldn't ever be significant.

This commit is contained in:
Charles Haley 2013-07-19 14:00:35 +02:00
parent a761e5a9d6
commit e336d8a2b9

View File

@ -137,6 +137,7 @@ class _Parser(object):
# We have a function.
# Check if it is a known one. We do this here so error reporting is
# better, as it can identify the tokens near the problem.
id = id.strip()
if id not in funcs:
self.error(_('unknown function {0}').format(id))
@ -246,6 +247,7 @@ class _CompileParser(_Parser):
# We have a function.
# Check if it is a known one. We do this here so error reporting is
# better, as it can identify the tokens near the problem.
id = id.strip()
if id not in funcs:
self.error(_('unknown function {0}').format(id))
@ -457,7 +459,7 @@ class TemplateFormatter(string.Formatter):
colon += 1
funcs = formatter_functions().get_functions()
fname = fmt[colon:p]
fname = fmt[colon:p].strip()
if fname in funcs:
func = funcs[fname]
if func.arg_count == 2: