[Django] #21881: block tags behavior with {% ssi %} is broken

5 views
Skip to first unread message

Django

unread,
Jan 27, 2014, 4:52:15 AM1/27/14
to django-...@googlegroups.com
#21881: block tags behavior with {% ssi %} is broken
---------------------------------+-----------------------
Reporter: nagyv | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.5
Severity: Normal | Keywords: ssi block
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+-----------------------
Please, see https://github.com/pulilab/django-ssi-tag-block for a simple
test app that demonstrates this bug.

What would you expect to be rendered when the `page.html` file gets
rendered with the following templates?


== page.html ==


{{{
{% extends "base.html" %}

{% block content %}
Everything fine. The content block was overwritten!
{% endblock %}
}}}


== base.html ==


{{{
{# included_template == ssi.html #}
{% ssi included_template parsed %}
}}}


== ssi.html ==

{{{
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
{% block content %}
This is the original content block. You should never see me.
{% endblock %}
</body>
</html>
}}}

My expectation would be to see the text "Everything fine. The content
block was overwritten!". But this did not happen.

--
Ticket URL: <https://code.djangoproject.com/ticket/21881>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 27, 2014, 5:05:56 AM1/27/14
to django-...@googlegroups.com
#21881: block tags behavior with {% ssi %} is broken
---------------------------------+--------------------------------------

Reporter: nagyv | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.5
Severity: Normal | Resolution:

Keywords: ssi block | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Hi,

I don't think that's a bug but rather a limitation of the current system.
It's documented as a note for the `{% include %}` tag [1]:

> The include tag should be considered as an implementation of “render
this subtemplate and include the HTML”, not as “parse this subtemplate and
include its contents as if it were part of the parent”. This means that
there is no shared state between included templates – each include is a
completely independent rendering process.

Maybe that should be made clearer in the paragraph for `{% ssi %}` too.
What do you think?

[1] https://docs.djangoproject.com/en/1.6/ref/templates/builtins/#include

--
Ticket URL: <https://code.djangoproject.com/ticket/21881#comment:1>

Django

unread,
Jan 27, 2014, 6:09:08 AM1/27/14
to django-...@googlegroups.com
#21881: block tags behavior with {% ssi %} is broken
---------------------------------+--------------------------------------

Reporter: nagyv | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.5
Severity: Normal | Resolution:

Keywords: ssi block | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by nagyv):

Reading the docs for the `{% ssi %}` tag tells just the opposite [1]:

> If the optional “parsed” parameter is given, the contents of the
included file are evaluated as template code, within the current context

This is the reason why I was using `ssi` instead of `include`.

[1] https://docs.djangoproject.com/en/1.5/ref/templates/builtins/#std
:templatetag-ssi

--
Ticket URL: <https://code.djangoproject.com/ticket/21881#comment:2>

Django

unread,
Jan 28, 2014, 10:27:56 PM1/28/14
to django-...@googlegroups.com
#21881: Clarify that `{% ssi ... parsed %}` has the same limitations as `{% include
%}`
-------------------------------+------------------------------------

Reporter: nagyv | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.5
Severity: Normal | Resolution:
Keywords: ssi block | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by bmispelon):

* component: Template system => Documentation
* easy: 0 => 1
* stage: Unreviewed => Accepted


Comment:

That sentence is not completely clear, I'll admit.

The fact is that `{% ssi %}` has the same limitations as `{% include %}`:
even when you use the `parsed` option, included templates are rendered
separately, so you can't for example alter the context or define blocks.
This is what the note in `{% include %}` tries to convey.

I'm going to mark this ticket as `accepted` (and change its description)
but as I see, it's a documentation issue.
We should make it more clear that the `parsed` option has the same
limitation as `{% include %}`.


What do you think?

--
Ticket URL: <https://code.djangoproject.com/ticket/21881#comment:3>

Django

unread,
Feb 10, 2014, 3:56:43 AM2/10/14
to django-...@googlegroups.com
#21881: Clarify that `{% ssi ... parsed %}` has the same limitations as `{% include
%}`
-------------------------------+------------------------------------
Reporter: nagyv | Owner: mamun
Type: Bug | Status: assigned

Component: Documentation | Version: 1.5
Severity: Normal | Resolution:
Keywords: ssi block | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by mamun):

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


--
Ticket URL: <https://code.djangoproject.com/ticket/21881#comment:4>

Django

unread,
Feb 23, 2014, 5:33:44 AM2/23/14
to django-...@googlegroups.com
#21881: Clarify that `{% ssi ... parsed %}` has the same limitations as `{% include
%}`
-------------------------------+------------------------------------
Reporter: nagyv | Owner: mamun
Type: Bug | Status: assigned
Component: Documentation | Version: 1.5
Severity: Normal | Resolution:
Keywords: ssi block | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by alextreme):

* has_patch: 0 => 1


Comment:

I've added a small note to the {% ssi %} tag documentation to clarify its
behaviour.

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

Django

unread,
Feb 23, 2014, 6:07:40 AM2/23/14
to django-...@googlegroups.com
#21881: Clarify that `{% ssi ... parsed %}` has the same limitations as `{% include
%}`
-------------------------------+------------------------------------
Reporter: nagyv | Owner: mamun
Type: Bug | Status: closed
Component: Documentation | Version: 1.5
Severity: Normal | Resolution: fixed

Keywords: ssi block | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Baptiste Mispelon <bmispelon@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"072fb923e1b2e39e85a4ed4569ee7cd94f26a0bb"]:
{{{
#!CommitTicketReference repository=""
revision="072fb923e1b2e39e85a4ed4569ee7cd94f26a0bb"
Fixed #21881 -- Clarify behavior of {% ssi %} template tag.

When using the `parsed` option, {% ssi %} has the same limitation
as {% include %}, namely that the rendering of the included
template is done separately.

Thanks to trac user nagyv for the report and to alextreme for
the patch.
}}}

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

Django

unread,
Feb 23, 2014, 8:01:38 AM2/23/14
to django-...@googlegroups.com
#21881: Clarify that `{% ssi ... parsed %}` has the same limitations as `{% include
%}`
-------------------------------+------------------------------------
Reporter: nagyv | Owner: mamun
Type: Bug | Status: closed
Component: Documentation | Version: 1.5
Severity: Normal | Resolution: fixed
Keywords: ssi block | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by Baptiste Mispelon <bmispelon@…>):

In [changeset:"a36513c2b41f50856144b8b66d5afc71e264b3cc"]:
{{{
#!CommitTicketReference repository=""
revision="a36513c2b41f50856144b8b66d5afc71e264b3cc"
[1.6.x] Fixed #21881 -- Clarify behavior of {% ssi %} template tag.

When using the `parsed` option, {% ssi %} has the same limitation
as {% include %}, namely that the rendering of the included
template is done separately.

Thanks to trac user nagyv for the report and to alextreme for
the patch.

Backport of 072fb923e1b2e39e85a4ed4569ee7cd94f26a0bb from master.
}}}

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

Reply all
Reply to author
Forward
0 new messages