#501 closed enhancement (fixed)
{{ block.super }} returns value of the most remote ancestor
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.syndication | Version: | 0.90 |
Severity: | minor | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
{{ block.super }} always returns value of the most remote ancestor. Example:
Template A:
{% block abc %}A{% endblock %}
Template B:
{% extends "A" %} {% block abc %}{{ block.super }}B{% endblock %}
Template C:
{% extends "B" %} {% block abc %}{{ block.super }}C{% endblock %}
Template A will be rendered as "A", B as "AB", C as "AC". I assume the original intention was to implement a stack of parents, so C would be rendered as "ABC". At least it is documented that way.
template_loader.py doesn't implement stacking order for blocks. Instead it defines two member variables in BlockNode: nodelist, which holds current nodes, and original_node_list, which holds nodes of the farthest ancestor.
Attachments (1)
Change History (6)
by , 19 years ago
Attachment: | block_super_fix.diff added |
---|
comment:1 by , 19 years ago
I have a set of templates that depend on {{ block.super }} working as described by Eugene. This little hack does the job for me. Even if you think the fix sucks the unit tests may be useful.
Cheers,
Kieran
comment:2 by , 19 years ago
Status: | new → assigned |
---|
comment:3 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:4 by , 18 years ago
Component: | Template system → RSS framework |
---|---|
milestone: | → Version 1.0 |
priority: | normal → low |
Severity: | normal → minor |
Type: | defect → enhancement |
Version: | → 0.9 |
A hack for this problem and some unit tests