Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fixed #3544, #12064, #16147 -- {% include %} behavior #1528

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
4 participants
Contributor

funkybob commented Aug 29, 2013

Merged BaseIncludeNode, ConstantIncludeNode and Include node.

This avoids raising TemplateDoesNotExist at parsing time, allows recursion
when passing a literal template name, and should make TEMPLATE_DEBUG behavior
consistant.

Owner

timgraham commented Aug 29, 2013

Are you planning to add some tests?

Contributor

funkybob commented Aug 29, 2013

I'm investigating the existing tests to see which of these cases they don't already cover.

Contributor

prestontimmons commented Aug 29, 2013

Good job simplifying my pull request. I had changed more stuff than was necessary.

I forked your branch and added the appropriate tests:

prestontimmons/django@e804ef0

I'm not sure if it's a problem, but I wrote the test using a standard test case, rather than the inline style you see with other tags. I just find those unwieldy to work with.

I tested your branch out on my side and things look like their working.

Contributor

funkybob commented Aug 30, 2013

Hey, thanks for that... I was struggling to get my own tests to fail on master. And it looks like yours don't fail on master, either...?

Fixed #3544, #12064, #16147 -- {% include %} behavior
Merged BaseIncludeNode, ConstantIncludeNode and Include node.

This avoids raising TemplateDoesNotExist at parsing time, allows recursion
when passing a literal template name, and should make TEMPLATE_DEBUG behavior
consistant.

Thanks loic84 for help with the tests.

@charettes charettes and 1 other commented on an outdated diff Aug 30, 2013

django/template/loader_tags.py
# Does this quack like a Template?
if not callable(getattr(template, 'render', None)):
# If not, we'll try get_template
template = get_template(template)
- return self.render_template(template, context)
+ values = dict([
+ (name, var.resolve(context))
+ for name, var in six.iteritems(self.extra_context)
+ ])
@charettes

charettes Aug 30, 2013

Member

Unneeded list comprehension.

@funkybob

funkybob Aug 30, 2013

Contributor

Was copied from the original, but sure... dict comprehension coming up

Owner

timgraham commented Aug 31, 2013

merged in e2f0622

@timgraham timgraham closed this Aug 31, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment