summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaise Laflamme <blaise@laflamme.org>2012-06-19 18:49:53 -0400
committerBlaise Laflamme <blaise@laflamme.org>2012-06-19 18:49:53 -0400
commitc358304043e7e68c7fc97dff42f88633b8f15c69 (patch)
tree7c7512838ef45c21086178406486d792df030c6f
parentf71ed59edb74e9a13362521918e2660e4e4263ba (diff)
downloadpyramid-c358304043e7e68c7fc97dff42f88633b8f15c69.tar.gz
pyramid-c358304043e7e68c7fc97dff42f88633b8f15c69.tar.bz2
pyramid-c358304043e7e68c7fc97dff42f88633b8f15c69.zip
added removed tuple for bw compat
-rw-r--r--pyramid/mako_templating.py3
-rw-r--r--pyramid/tests/test_mako_templating.py8
2 files changed, 11 insertions, 0 deletions
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)