summaryrefslogtreecommitdiff
path: root/examples/nested_context.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/nested_context.py')
-rw-r--r--examples/nested_context.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/examples/nested_context.py b/examples/nested_context.py
index 83565a1..4626ac0 100644
--- a/examples/nested_context.py
+++ b/examples/nested_context.py
@@ -1,7 +1,12 @@
-import pystache
+from pystache import TemplateSpec
-class NestedContext(pystache.View):
- template_path = 'examples'
+class NestedContext(TemplateSpec):
+
+ def __init__(self, renderer):
+ self.renderer = renderer
+
+ def _context_get(self, key):
+ return self.renderer.context.get(key)
def outer_thing(self):
return "two"
@@ -16,6 +21,6 @@ class NestedContext(pystache.View):
return [{'outer': 'car'}]
def nested_context_in_view(self):
- if self.get('outer') == self.get('inner'):
+ if self._context_get('outer') == self._context_get('inner'):
return 'it works!'
- return '' \ No newline at end of file
+ return ''