You can clone with
HTTPS or Subversion.
Related to issue #8, if you put a partial within a section, it won't be able to find the template if you are using 'template_path' in your view.
If you set template_path in your view for outer.mustache, that template_path is not used to find rendervalues.mustache because though we are using a View, the values aren't 'inherited'.
Bug is in here:
def render_partial(self, tag_name=None, context=None):
"""Renders a partial within the current context."""
# Import view here to avoid import loop
from pystache.view import View
view = View(context=context)
view.template_name = tag_name
In the above, the view 'settings' would be correctly copied over if context was a view, but since this is while rendering a section, context is something else.
The real issue is the strange relationship between templates and views. As the comment above indicates, there is a 'loop' between views and templates... Really it's a bad case of tight coupling. Views need templates, and templates need views.
I believe the specific issue raised by this post has been addressed in master by now, as well as in the development branch:
def _render_partial(self, template_name):
markup = self.view.load_template(template_name)
template = Template(markup, self.view)
And in the View class:
def load_template(self, template_name):
from pystache import Loader
return Loader().load_template(template_name, self.template_path,
However, we should still add a test case to check that "template_path" is being honored (or verify that we already have such a test case).
I also agree that templates and views should not depend on each other. It looks like the code may have tied them even further together since this issue was initially filed.
Merge branch 'issue_13' into development: closing issue #13.
Added test cases to check that View.template_path is respected.