Modify ↓
#14042 closed defect (fixed)
TracTicketReferencePlugin does not work with Trac 1.4
| Reported by: | Eric Berquist | Owned by: | Tetsuya Morimoto |
|---|---|---|---|
| Priority: | normal | Component: | TracTicketReferencePlugin |
| Severity: | normal | Keywords: | |
| Cc: | Trac Release: | 1.4 |
Description
I'm seeing this in trac.log:
2021-08-07 20:36:55,201 Trac[chrome] ERROR: Jinja2 TypeError error while rendering XML/HTML template
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/trac/web/chrome.py", line 1706, in _iterable_jinja_content
for chunk in stream:
File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 1357, in __next__
return self._next()
File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 1334, in _buffered_generator
c = next(self._gen)
File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 1125, in generate
yield self.environment.handle_exception()
File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/usr/local/lib/python2.7/dist-packages/trac/ticket/templates/ticket.html", line 12, in top-level template code
# extends 'layout.html'
File "/usr/local/lib/python2.7/dist-packages/trac/templates/layout.html", line 12, in top-level template code
# import "macros.html" as jmacros with context
File "/usr/local/lib/python2.7/dist-packages/trac/templates/theme.html", line 16, in top-level template code
# block head
File "/usr/local/lib/python2.7/dist-packages/trac/ticket/templates/ticket.html", line 30, in block "head"
${ super() }
File "/usr/local/lib/python2.7/dist-packages/trac/templates/layout.html", line 61, in block "head"
var ${key}=${to_json(value)|safe};
File "/usr/local/lib/python2.7/dist-packages/trac/util/presentation.py", line 479, in to_json
text = TracJSONEncoder(sort_keys=True, separators=(',', ':')).encode(value)
File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
chunks = list(chunks)
File "/usr/lib/python2.7/json/encoder.py", line 431, in _iterencode
for chunk in _iterencode_list(o, _current_indent_level):
File "/usr/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
for chunk in chunks:
File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
for chunk in chunks:
File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
for chunk in chunks:
File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
for chunk in chunks:
File "/usr/lib/python2.7/json/encoder.py", line 442, in _iterencode
o = _default(o)
File "/usr/local/lib/python2.7/dist-packages/trac/util/presentation.py", line 473, in default
return JSONEncoder.default(self, o)
File "/usr/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <Fragment> is not JSON serializable
Attachments (0)
Note: See
TracTickets for help on using
tickets.



The plugin currently doesn't support Trac 1.4.
Could you please try the following patch and let us know the results?
ticketref/api.py
self.env.get_db_cnx())):ticketref/web_ui.py
from genshi.builder import tag