Jina2 2.11.0 on Trac 1.4: "the inline if-expression on line 109 in 'theme.html' evaluated to false and no else section was defined"

392 views
Skip to first unread message

Charles Bearden

unread,
Jan 29, 2020, 6:13:00 PM1/29/20
to Trac Users
Hi all,

I'm working on creating a fresh up-to-date Trac install recipe for my department, and I encountered an exception with Jinja2 2.11.0 under Trac 1.4. I wanted to run this problem by the list before logging a ticket.

Ubuntu 18.04
Python 2.7.17 virtualenv
Installing newest version of all prerequisites with pip

When I run the server via tracd, the main page displays correctly, but when I click Timeline, Roadmap, View Tickets, or Search, only part of the page source is returned (nothing renderable by the browser) and an exception appears in the trac.log:

2020-01-29 16:22:41,020 Trac[chrome] ERROR: Jinja2 UndefinedError error while rendering XML/HTML template
Traceback (most recent call last):
  File "/path/to/projects/tmp/trac/venv2/local/lib/python2.7/site-packages/trac/web/chrome.py", line 1704, in _iterable_jinja_content
    for chunk in stream:
  File "/path/to/projects/tmp/trac/venv2/local/lib/python2.7/site-packages/jinja2/environment.py", line 1357, in __next__
    return self._next()
  File "/path/to/projects/tmp/trac/venv2/local/lib/python2.7/site-packages/jinja2/environment.py", line 1334, in _buffered_generator
    c = next(self._gen)
  File "/path/to/projects/tmp/trac/venv2/local/lib/python2.7/site-packages/jinja2/environment.py", line 1125, in generate
    yield self.environment.handle_exception()
  File "/path/to/projects/tmp/trac/venv2/local/lib/python2.7/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/path/to/projects/tmp/trac/venv2/local/lib/python2.7/site-packages/trac/timeline/templates/timeline.html", line 12, in top-level template code
    # extends 'layout.html'
  File "/path/to/projects/tmp/trac/venv2/local/lib/python2.7/site-packages/trac/templates/layout.html", line 12, in top-level template code
    # import "macros.html" as jmacros with context
  File "/path/to/projects/tmp/trac/venv2/local/lib/python2.7/site-packages/trac/templates/theme.html", line 22, in top-level template code
    # block body
  File "/path/to/projects/tmp/trac/venv2/local/lib/python2.7/site-packages/trac/templates/theme.html", line 109, in block "body"
    # include resourcepath_template if resourcepath_template ignore missing
  File "/path/to/projects/tmp/trac/venv2/local/lib/python2.7/site-packages/jinja2/loaders.py", line 179, in get_source
    pieces = split_template_path(template)
  File "/path/to/projects/tmp/trac/venv2/local/lib/python2.7/site-packages/jinja2/loaders.py", line 28, in split_template_path
    for piece in template.split("/"):
UndefinedError: the inline if-expression on line 109 in 'theme.html' evaluated to false and no else section was defined.

When I pin Jinja2 to 2.10.3, the problem goes away. So, it seems like changes to Jinja2 from 2.10 to 2.11 cause this breakage.

Anyone else seen this?

All the best,
Chuck Bearden



Ryan Ollos

unread,
Jan 29, 2020, 6:13:57 PM1/29/20
to Trac Users

Charles Bearden

unread,
Jan 30, 2020, 10:34:47 AM1/30/20
to Trac Users
Thanks. I did search the tickets at Edgewall, but somehow I didn't find that one.
Reply all
Reply to author
Forward
0 new messages