Commit 524e4e75 authored by David Glick's avatar David Glick

merge r110118-110121 from 2.12 branch

parent 6205dfa9
......@@ -231,7 +231,7 @@ class view(zope.browserpage.metaconfigure.view):
if view is not None:
return view
raise NotFoundError(self, name, request)
raise NotFound(self, name, request)
cdict['publishTraverse'] = publishTraverse
......@@ -422,6 +422,8 @@ class ViewMixinForTemplates(BrowserView):
raise NotFound(self, name, request)
def __getitem__(self, name):
if name == 'macros':
return self.index.macros
return self.index.macros[name]
def __call__(self, *args, **kw):
......
......@@ -41,6 +41,12 @@ class ViewMixinForTemplatesTests(unittest.TestCase):
index.macros = {}
index.macros['aaa'] = aaa = object()
self.failUnless(view['aaa'] is aaa)
def test__getitem__gives_shortcut_to_index_macros(self):
view = self._makeOne()
view.index = index = DummyTemplate()
index.macros = {}
self.failUnless(view['macros'] is index.macros)
def test___call___no_args_no_kw(self):
view = self._makeOne()
......@@ -63,7 +69,7 @@ class ViewMixinForTemplatesTests(unittest.TestCase):
self.failUnless(result is index)
self.assertEqual(index._called_with, ((), {'foo': 'bar'}))
def test___call___no_args_no_kw(self):
def test___call___w_args_w_kw(self):
view = self._makeOne()
view.index = index = DummyTemplate()
result = view('abc', foo='bar')
......
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