Commit 06c5544e by Chris Wanstrath

referencing basic view methods from a template works

parent 05a1c575
import pystache
from pystache import Template
import os.path
class View(object):
......@@ -35,7 +35,12 @@ class View(object):
def template_name(self):
return self.__class__.__name__
def get(self, attr, default):
if hasattr(self, attr):
return getattr(self, attr)()
else:
return default
def render(self):
template = self.load_template()
return pystache.render(template, self.context)
return Template(template, self).render()
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