for example
index.html
...
{% include "inc_home.html" %}
...
and inc_home.html has an invalid variable, Dajngo raise error at the
beginning of index.html
work fine with {% extends %}
--
Ticket URL: <https://code.djangoproject.com/ticket/26365>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
I can't reproduce this given the information you provided. Could you
provide a complete example as a sample project or as a test case for
Django's test suite (tests/template_tests)?
--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:1>
* Attachment "template_bug.zip" added.
Comment (by timgraham):
What version of Django are you using? On Django 1.8.x and Django 1.9.x,
the sample project is crashing with:
{{{
File "/home/tim/code/django/django/template/base.py", line 1043, in
render
output = self.filter_expression.resolve(context)
File "/home/tim/code/django/django/template/base.py", line 716, in
resolve
if '%s' in string_if_invalid:
TypeError: argument of type 'bool' is not iterable
}}}
If I change the value to a string, e.g. `'string_if_invalid': 'fooo',`,
I'm seeing that value in the homepage output.
--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:2>
Comment (by JosephDev):
Replying to [comment:2 timgraham]:
> What version of Django are you using? On Django 1.8.x and Django 1.9.x,
the sample project is crashing with:
> {{{
> File "/home/tim/code/django/django/template/base.py", line 1043, in
render
> output = self.filter_expression.resolve(context)
> File "/home/tim/code/django/django/template/base.py", line 716, in
resolve
> if '%s' in string_if_invalid:
> TypeError: argument of type 'bool' is not iterable
> }}}
> If I change the value to a string, e.g. `'string_if_invalid': 'fooo',`,
I'm seeing that value in the homepage output.
1.9.4 and it's intended error. Because, Django raised error but not
indicate appropriate location in code if html file is included.
--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:3>
* component: Template system => Core (System checks)
* type: Bug => New feature
* stage: Unreviewed => Accepted
Comment:
`string_if_invalid` must be a string, not a boolean. We could add a system
check to catch this mistake.
--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:4>
* status: new => assigned
* owner: nobody => vincepandolfo
--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:5>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:6>
* needs_better_patch: 0 => 1
Comment:
Left comments for improvement.
--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:7>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"abf07355aa5d85f4bb4dd9912d70fa62511fa40f" abf0735]:
{{{
#!CommitTicketReference repository=""
revision="abf07355aa5d85f4bb4dd9912d70fa62511fa40f"
Fixed #26365 -- Added a system check to ensure "string_is_invalid" is a
string.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:9>