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



-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/8709da69-33d8-46b6-9031-41f231634970%40googlegroups.com.

Reply via email to