Modify ↓
#13242 closed defect (fixed)
UndefinedError: the inline if-expression on line 109 in 'theme.html' evaluated to false and no else section was defined.
| Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.4.1 |
| Component: | general | Version: | 1.4 |
| Severity: | normal | Keywords: | jinja2 |
| Cc: | Branch: | ||
| Release Notes: |
Fixed compatibility issues with Jinja2 version 2.11. |
||
| API Changes: | |||
| Internal Changes: | |||
Description
Tests pass with Jinja2 2.10.3, but 2.11 released on 27 Jan 2020 has the following failure:
SKIP_FUNCTIONAL_TESTS=1 python -m unittest -f -c trac.test.test_suite
..............................E
======================================================================
ERROR: test_preview_valid_xhtml (trac.tests.attachment.AttachmentModuleTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "trac/tests/attachment.py", line 610, in test_preview_valid_xhtml
result = render(attachment)
File "trac/tests/attachment.py", line 605, in render
{'fragment': True})
File "trac/web/chrome.py", line 1441, in render_template
fragment, iterable, method)
File "trac/web/chrome.py", line 1526, in _render_jinja_template
s = self.render_template_string(template, data, text)
File "trac/web/chrome.py", line 1675, in render_template_string
string = template.render(data)
File "/Users/rjollos/.pyenv/versions/trac-2.7.15/lib/python2.7/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/Users/rjollos/.pyenv/versions/trac-2.7.15/lib/python2.7/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "trac/templates/attachment.html", line 14, in top-level template code
# set parent = attachments.parent if attachments else attachment.resource.parent
File "trac/templates/layout.html", line 12, in top-level template code
# import "macros.html" as jmacros with context
File "trac/templates/theme.html", line 22, in top-level template code
# block body
File "trac/templates/theme.html", line 109, in block "body"
# include resourcepath_template if resourcepath_template ignore missing
File "/Users/rjollos/.pyenv/versions/trac-2.7.15/lib/python2.7/site-packages/jinja2/loaders.py", line 179, in get_source
pieces = split_template_path(template)
File "/Users/rjollos/.pyenv/versions/trac-2.7.15/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.
----------------------------------------------------------------------
Ran 31 tests in 0.466s
FAILED (errors=1)
make: *** [unit-test] Error 1
Attachments (0)
Change History (7)
comment:1 by , 6 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:3 by , 6 years ago
| Release Notes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Thanks, committed in [17236:17237].
comment:5 by , 6 years ago
Edited TracDev/PortingFromGenshiToJinja@49.
I haven't found a way to write an inline conditional that uses ignore missing after Jinja2 2.11. I made the same comment here as well.
comment:6 by , 6 years ago
| Version: | → 1.4 |
|---|
comment:7 by , 18 months ago
Note:
See TracTickets
for help on using tickets.



Removing the inline
iffor# includestatements fixes the issue ([4542edb57/rjollos.git]):trac/templates/theme.html
trac/ticket/templates/milestone_view.html
trac/ticket/templates/query.html
trac/ticket/templates/roadmap.html