Fixed a bug with the loop context of a for loop if the iterator passed has a volatile `__len__` like the listreverseiterator.  `else` in inline if-expressions is optional now.

--HG--
branch : trunk
diff --git a/tests/test_syntax.py b/tests/test_syntax.py
index 4d28dbc..29b3974 100644
--- a/tests/test_syntax.py
+++ b/tests/test_syntax.py
@@ -8,7 +8,7 @@
 """
 from py.test import raises
 from jinja2 import Environment, DictLoader
-from jinja2.exceptions import TemplateSyntaxError
+from jinja2.exceptions import TemplateSyntaxError, UndefinedError
 
 
 CALL = '''{{ foo('a', c='d', e='f', *['b'], **{'g': 'h'}) }}'''
@@ -124,6 +124,14 @@
     assert tmpl.render() == '0'
 
 
+def test_short_conditional_expression(env):
+    tmpl = env.from_string('<{{ 1 if false }}>')
+    assert tmpl.render() == '<>'
+
+    tmpl = env.from_string('<{{ (1 if false).bar }}>')
+    raises(UndefinedError, tmpl.render)
+
+
 def test_filter_priority(env):
     tmpl = env.from_string(FILTERPRIORITY)
     assert tmpl.render() == 'FOOBAR'