Commit 5ce9ac22 by Eric Florenzano

Assigning a default context argument actually creates a global, which I don't…

Assigning a default context argument  actually creates a global, which I don't think was the intended effect.  More discussion and a better explanation of this can be found at http://bit.ly/1iw46
parent 4812cdd7
...@@ -9,9 +9,9 @@ class Template(object): ...@@ -9,9 +9,9 @@ class Template(object):
'!': 'comment' '!': 'comment'
} }
def __init__(self, template, context={}): def __init__(self, template, context=None):
self.template = template self.template = template
self.context = context self.context = context or {}
def render(self, template=None, context=None): def render(self, template=None, context=None):
"""Turns a Mustache template into something wonderful.""" """Turns a Mustache template into something wonderful."""
......
...@@ -15,9 +15,9 @@ class View(object): ...@@ -15,9 +15,9 @@ class View(object):
# Contents of the template. # Contents of the template.
template = None template = None
def __init__(self, template=None, context={}, **kwargs): def __init__(self, template=None, context=None, **kwargs):
self.template = template self.template = template
self.context = context self.context = context or {}
self.context.update(kwargs) self.context.update(kwargs)
def load_template(self): def load_template(self):
......
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