Context.locals_() does not update the returned Context's `kwargs` attribute

Issue #219 resolved
guest
created an issue

unit test:

class ContextTest(unittest.TestCase):
  def test_locals_kwargs(self):
    c = Context(None, foo='bar')
    self.assertEqual(c.kwargs, {'foo': 'bar'})
    d = c.locals_({'zig': 'zag'})
    self.assertEqual(c.kwargs, {'foo': 'bar'})
    self.assertEqual(d.kwargs, {'foo': 'bar', 'zig': 'zag'})

attached is a patch for mako 0.7.2.

Comments (2)

  1. Michael Bayer repo owner

    OK not sure what your use case was since I don't have one here, if it was that you were calling locals_() yourself for something, that's not what its for, and if it was that you were using context.kwargs and expecting some local variable or something to be present inside of it, that's also not what its for, else there would be no need for kwargs to be maintained separately in the first place. So locals_() is now _locals() and documentation has been clarified in 420a0831eedd9c0679.

  2. Log in to comment