[Django] #26365: template option "string_if_invalid" can't find error location whit including html

7 views
Skip to first unread message

Django

unread,
Mar 16, 2016, 7:58:20 AM3/16/16
to django-...@googlegroups.com
#26365: template option "string_if_invalid" can't find error location whit
including html
---------------------------------+--------------------
Reporter: JosephDev | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------
template option "string_if_invalid" cannot find error location with
including html

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.

Django

unread,
Mar 16, 2016, 8:07:35 AM3/16/16
to django-...@googlegroups.com
#26365: template option "string_if_invalid" can't find error location whit
including html
---------------------------------+--------------------------------------

Reporter: JosephDev | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by timgraham):

* 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>

Django

unread,
Mar 16, 2016, 8:23:15 AM3/16/16
to django-...@googlegroups.com
#26365: template option "string_if_invalid" can't find error location whit
including html
---------------------------------+--------------------------------------

Reporter: JosephDev | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by JosephDev):

* Attachment "template_bug.zip" added.

Django

unread,
Mar 16, 2016, 8:43:36 AM3/16/16
to django-...@googlegroups.com
#26365: template option "string_if_invalid" can't find error location whit
including html
---------------------------------+--------------------------------------

Reporter: JosephDev | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

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>

Django

unread,
Mar 16, 2016, 8:59:07 AM3/16/16
to django-...@googlegroups.com
#26365: template option "string_if_invalid" can't find error location whit
including html
---------------------------------+--------------------------------------

Reporter: JosephDev | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

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>

Django

unread,
Mar 16, 2016, 9:25:06 AM3/16/16
to django-...@googlegroups.com
#26365: Add a system check to ensure "string_if_invalid" is a string
--------------------------------------+------------------------------------
Reporter: JosephDev | Owner: nobody
Type: New feature | Status: new
Component: Core (System checks) | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* 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>

Django

unread,
Mar 18, 2016, 8:11:49 AM3/18/16
to django-...@googlegroups.com
#26365: Add a system check to ensure "string_if_invalid" is a string
-------------------------------------+-------------------------------------
Reporter: JosephDev | Owner:
| vincepandolfo
Type: New feature | Status: assigned
Component: Core (System | Version: 1.9
checks) |

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by vincepandolfo):

* status: new => assigned
* owner: nobody => vincepandolfo


--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:5>

Django

unread,
Mar 18, 2016, 8:50:47 AM3/18/16
to django-...@googlegroups.com
#26365: Add a system check to ensure "string_if_invalid" is a string
-------------------------------------+-------------------------------------
Reporter: JosephDev | Owner:
| vincepandolfo
Type: New feature | Status: assigned
Component: Core (System | Version: 1.9
checks) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by vincepandolfo):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:6>

Django

unread,
Mar 18, 2016, 10:06:18 AM3/18/16
to django-...@googlegroups.com
#26365: Add a system check to ensure "string_if_invalid" is a string
-------------------------------------+-------------------------------------
Reporter: JosephDev | Owner:
| vincepandolfo
Type: New feature | Status: assigned
Component: Core (System | Version: 1.9
checks) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


Comment:

Left comments for improvement.

--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:7>

Django

unread,
Mar 18, 2016, 12:01:50 PM3/18/16
to django-...@googlegroups.com
#26365: Add a system check to ensure "string_if_invalid" is a string
-------------------------------------+-------------------------------------
Reporter: JosephDev | Owner:
| vincepandolfo
Type: New feature | Status: assigned
Component: Core (System | Version: 1.9
checks) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/26365#comment:8>

Django

unread,
Mar 21, 2016, 1:06:58 PM3/21/16
to django-...@googlegroups.com
#26365: Add a system check to ensure "string_if_invalid" is a string
-------------------------------------+-------------------------------------
Reporter: JosephDev | Owner:
| vincepandolfo
Type: New feature | Status: closed

Component: Core (System | Version: 1.9
checks) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* 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>

Reply all
Reply to author
Forward
0 new messages