Commit 79817d51 by Carl Whittaker

Fixed missing context attribute.

parent 0a655dc6
...@@ -29,10 +29,10 @@ class View(object): ...@@ -29,10 +29,10 @@ class View(object):
def __init__(self, template=None, context=None, **kwargs): def __init__(self, template=None, context=None, **kwargs):
self.template = template self.template = template
context = context or {} self.context = context or {}
context.update(**kwargs) self.context.update(**kwargs)
self.context_list = [context] self.context_list = [self.context]
def get(self, attr, default=None): def get(self, attr, default=None):
attr = get_or_attr(self.context_list, attr, getattr(self, attr, default)) attr = get_or_attr(self.context_list, attr, getattr(self, attr, default))
...@@ -77,15 +77,5 @@ class View(object): ...@@ -77,15 +77,5 @@ class View(object):
raise KeyError("No such key '%s'." % attr) raise KeyError("No such key '%s'." % attr)
return val return val
def __getattr__(self, attr):
if attr == 'context':
context = {}
for d in self.context_list:
context.update(d)
return context
raise AttributeError("No such attribute '%s'." % attr)
def __str__(self): def __str__(self):
return self.render() return self.render()
\ No newline at end of file
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