Ticket #13167: 13167_filterargfix.diff
File 13167_filterargfix.diff, 1.9 KB (added by , 15 years ago) |
---|
-
django/template/__init__.py
570 570 if not lookup: 571 571 arg_vals.append(mark_safe(arg)) 572 572 else: 573 arg_vals.append(arg.resolve(context)) 573 try: 574 arg_vals.append(arg.resolve(context)) 575 except VariableDoesNotExist: 576 if settings.TEMPLATE_DEBUG: 577 raise 578 else: 579 arg_vals.append(settings.TEMPLATE_STRING_IF_INVALID) 574 580 if getattr(func, 'needs_autoescape', False): 575 581 new_obj = func(obj, autoescape=context.autoescape, *arg_vals) 576 582 else: -
tests/regressiontests/templates/tests.py
778 778 'if-tag-error11': ("{% if 1 == %}yes{% endif %}", {}, template.TemplateSyntaxError), 779 779 'if-tag-error12': ("{% if a not b %}yes{% endif %}", {}, template.TemplateSyntaxError), 780 780 781 # Non-existent args 782 'if-tag-badarg01':("{% if x|default_if_none:y %}yes{% endif %}", {}, ('', 'yes')), 783 'if-tag-badarg02':("{% if x|default_if_none:y %}yes{% endif %}", {'y': 0}, ''), 784 'if-tag-badarg03':("{% if x|default_if_none:y %}yes{% endif %}", {'y': 1}, 'yes'), 785 'if-tag-badarg04':("{% if x|default_if_none:y %}yes{% else %}no{% endif %}", {}, ('no', 'yes')), 786 781 787 # Additional, more precise parsing tests are in SmartIfTests 782 788 783 789 ### IFCHANGED TAG #########################################################