Commit 9029b4ba by Chris Jerdonek

Simplified pystache.render(): now shares code with Template.__init__().

parent 78bb39e3
...@@ -18,7 +18,4 @@ def render(template, context=None, **kwargs): ...@@ -18,7 +18,4 @@ def render(template, context=None, **kwargs):
Return the given template string rendered using the given context. Return the given template string rendered using the given context.
""" """
context = context and context.copy() or {} return Template(template, context, **kwargs).render()
context.update(kwargs)
return Template(template, context).render()
...@@ -73,7 +73,8 @@ class Template(object): ...@@ -73,7 +73,8 @@ class Template(object):
if context is None: if context is None:
context = {} context = {}
elif not isinstance(context, View):
if not isinstance(context, View):
# Views do not support copy() or update(). # Views do not support copy() or update().
context = context.copy() context = context.copy()
if kwargs: if kwargs:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment