def test_init__kwargs_does_not_modify_context(self): """ Test that passing **kwargs does not modify the passed context. """ context = {"foo": "bar"} view = View(context=context, fuzz="buzz") self.assertEquals(context, {"foo": "bar"})
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 return view.render()
def __init__(self, template=None, context=None, **kwargs): from pystache.view import View self.template = template if kwargs: context.update(kwargs) self.view = context if isinstance(context, View) else View( context=context) self._compile_regexps()