items have a higher priority than attributes now. That's compatible with Jinja1 and Django
--HG--
branch : trunk
diff --git a/tests/test_various.py b/tests/test_various.py
index 147f459..7a3882e 100644
--- a/tests/test_various.py
+++ b/tests/test_various.py
@@ -58,3 +58,13 @@
escape(u"<foo>")
counts.add(len(gc.get_objects()))
assert len(counts) == 1, 'ouch, c extension seems to leak objects'
+
+
+def test_item_before_attribute():
+ from jinja2 import Environment
+ from jinja2.sandbox import SandboxedEnvironment
+
+ for env in Environment(), SandboxedEnvironment():
+ tmpl = env.from_string('{{ foo.items() }}')
+ assert tmpl.render(foo={'items': lambda: 42}) == '42'
+ assert tmpl.render(foo={}) == '[]'