Commit 65646c81 by Joshua Roesslein Committed by Chris Wanstrath

Allow using View instances as attributes.

parent f03c85c7
## 0.2.0 (2009-11-16)
* Add support for using non-callables as View attributes. [joshthecoder]
* Allow using View instances as attributes. [joshthecoder]
## 0.1.1 (2009-11-13)
......
......@@ -89,3 +89,6 @@ class View(object):
def render(self):
template = self.load_template()
return Template(template, self).render()
def __str__(self):
return self.render()
......@@ -26,6 +26,13 @@ class TestView(unittest.TestCase):
view.thing = 'Chris'
self.assertEquals(view.render(), "Hi Chris!")
def test_view_instances_as_attributes(self):
other = Simple(name='chris')
other.template = '{{name}}'
view = Simple()
view.thing = other
self.assertEquals(view.render(), "Hi chris!")
def test_complex(self):
self.assertEquals(ComplexView().render(), """<h1>Colors</h1>
<ul>
......
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