summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)