Commit d14e40dd by Chris Jerdonek

Removed template from the View constructor.

parent dc732360
......@@ -52,7 +52,7 @@ class View(object):
locator = TemplateLocator()
def __init__(self, template=None, context=None, partials=None, **kwargs):
def __init__(self, context=None, partials=None, **kwargs):
"""
Construct a View instance.
......@@ -66,9 +66,6 @@ class View(object):
no template with that name, or raise an exception.
"""
if template is not None:
self.template = template
context = Context.create(self, context, **kwargs)
self._partials = partials
......
......@@ -37,12 +37,6 @@ class TestView(unittest.TestCase):
def test_literal(self):
self.assertEquals(Unescaped().render(), "<h1>Bear > Shark</h1>")
def test_literal_sigil(self):
view = Escaped(template="<h1>{{& thing}}</h1>", context={
'thing': 'Bear > Giraffe'
})
self.assertEquals(view.render(), "<h1>Bear > Giraffe</h1>")
def test_template_partial(self):
self.assertEquals(TemplatePartial().render(), """<h1>Welcome</h1>
Again, Welcome!""")
......
......@@ -92,6 +92,14 @@ class RenderTests(unittest.TestCase):
self._assert_render('BAR', '{{{foo}}}', {'foo': 'bar'}, engine=engine)
def test_literal__sigil(self):
template = "<h1>{{& thing}}</h1>"
context = {'thing': 'Bear > Giraffe'}
expected = "<h1>Bear > Giraffe</h1>"
self._assert_render(expected, template, context)
def test__escape(self):
"""
Test that render() uses the escape attribute.
......
......@@ -47,10 +47,6 @@ class ViewTestCase(unittest.TestCase):
view = View(context=context, fuzz="buzz")
self.assertEquals(context, {"foo": "bar"})
def test_basic(self):
view = Simple("Hi {{thing}}!", { 'thing': 'world' })
self.assertEquals(view.render(), "Hi world!")
def test_kwargs(self):
view = Simple("Hi {{thing}}!", thing='world')
self.assertEquals(view.render(), "Hi world!")
......@@ -59,18 +55,6 @@ class ViewTestCase(unittest.TestCase):
view = Simple(thing='world')
self.assertEquals(view.render(), "Hi world!")
def test_render__partials(self):
"""
Test passing partials to View.__init__().
"""
template = "{{>partial}}"
partials = {"partial": "Loaded from dictionary"}
view = Simple(template=template, partials=partials)
actual = view.render()
self.assertEquals(actual, "Loaded from dictionary")
def test_template_path(self):
"""
Test that View.template_path is respected.
......
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