summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wanstrath <chris@ozmm.org>2009-10-30 11:13:52 -0700
committerChris Wanstrath <chris@ozmm.org>2009-10-30 11:13:52 -0700
commita6dfe036d83f03620c0c4314d1a77a1af05854b0 (patch)
tree7843c4bd42ec8e1ae2b48837abf215d561e7826a
parent06c5544ee9b7e7b955cc9e32109c01338ff23495 (diff)
downloadpystache-a6dfe036d83f03620c0c4314d1a77a1af05854b0.tar.gz
check the context before hitting a view method
-rw-r--r--pystache/view.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/pystache/view.py b/pystache/view.py
index 40361a0..cdcac5f 100644
--- a/pystache/view.py
+++ b/pystache/view.py
@@ -36,7 +36,9 @@ class View(object):
return self.__class__.__name__
def get(self, attr, default):
- if hasattr(self, attr):
+ if attr in self.context:
+ return self.context[attr]
+ elif hasattr(self, attr):
return getattr(self, attr)()
else:
return default