From c358304043e7e68c7fc97dff42f88633b8f15c69 Mon Sep 17 00:00:00 2001 From: Blaise Laflamme Date: Tue, 19 Jun 2012 18:49:53 -0400 Subject: added removed tuple for bw compat --- pyramid/mako_templating.py | 3 +++ pyramid/tests/test_mako_templating.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/pyramid/mako_templating.py b/pyramid/mako_templating.py index 48288c930..f866e2630 100644 --- a/pyramid/mako_templating.py +++ b/pyramid/mako_templating.py @@ -173,6 +173,9 @@ class MakoLookupTemplateRenderer(object): context = system.pop('context', None) if context is not None: system['_context'] = context + if self.defname is None: + if isinstance(value, tuple): + self.defname, value = value try: system.update(value) except (TypeError, ValueError): diff --git a/pyramid/tests/test_mako_templating.py b/pyramid/tests/test_mako_templating.py index cd7b140d6..6cfa3ea4b 100644 --- a/pyramid/tests/test_mako_templating.py +++ b/pyramid/tests/test_mako_templating.py @@ -338,6 +338,14 @@ class MakoLookupTemplateRendererTests(Base, unittest.TestCase): self.assertEqual(result, text_('result')) self.assertEqual(lookup.values, {'_context':1}) + def test_call_with_tuple_value(self): + lookup = DummyLookup() + instance = self._makeOne('path', None, lookup) + result = instance(('fub', {}), {'context':1}) + self.assertEqual(lookup.deffed, 'fub') + self.assertEqual(result, text_('result')) + self.assertEqual(lookup.values, {'_context':1}) + def test_call_with_defname(self): lookup = DummyLookup() instance = self._makeOne('path', 'defname', lookup) -- cgit v1.2.3