﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24199	string_if_invalid doesn't provide information in many cases	adam-iris	nobody	"There's a check for ""%s"" and variable information is added, but only when handling VariableDoesNotExist for simple variables:

{{{
            except VariableDoesNotExist:
                if ignore_failures:
                    obj = None
                else:
                    string_if_invalid = context.engine.string_if_invalid
                    if string_if_invalid:
                        if '%s' in string_if_invalid:
                            return string_if_invalid % self.var
                        else:
                            return string_if_invalid
                    else:
                        obj = string_if_invalid
}}}

But string_if_invalid is also used in other cases, for example if a TypeError is raised from a method:

{{{
                if callable(current):
                    if getattr(current, 'do_not_call_in_templates', False):
                        pass
                    elif getattr(current, 'alters_data', False):
                        current = context.engine.string_if_invalid
                    else:
                        try:  # method call (assuming no args required)
                            current = current()
                        except TypeError:
                            try:
                                getcallargs(current)
                            except TypeError:  # arguments *were* required
                                current = context.engine.string_if_invalid  # invalid method call
}}}

In those cases, there's no check for ""%s"" and nothing about the method or the exception is included, making this largely useless for debugging.
"	Cleanup/optimization	new	Template system	dev	Normal			django@…	Accepted	0	0	0	0	0	0
