Commit 6e83a2e3 by Chris Wanstrath

Revert "Better way to perform callable check. Allow callables from context attributes."

This reverts commit 08b06f9c.
parent 08b06f9c
......@@ -76,12 +76,15 @@ class View(object):
return re.sub('[A-Z]', repl, name)[1:]
def get(self, attr, default):
attr = self.context.get(attr, getattr(self, attr, default))
if callable(attr):
return attr()
if attr in self.context:
return self.context[attr]
elif hasattr(self, attr):
try:
return getattr(self, attr)()
except TypeError:
return getattr(self, attr)
else:
return attr
return default
def render(self):
template = self.load_template()
......
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