Opened 2 months ago

Closed 2 months ago

#332 closed defect (fixed)

trac wirft einen Fehler 500

Reported by: Jens Kubieziel Owned by: Admins für trac
Priority: major Component: Dienste/trac
Keywords: trac, jinja Cc:

Description

Das trac wirft bei dem Aufruf einen Fehler 500. Das Log sagt:

Mai 09 08:27:13 sauerkraut tracd[3799586]: Traceback (most recent call last):
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "/usr/bin/tracd", line 33, in <module>
Mai 09 08:27:13 sauerkraut tracd[3799586]:     sys.exit(load_entry_point('Trac==1.5.3', 'console_scripts', 'tracd')())
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "/usr/bin/tracd", line 25, in importlib_load_entry_point
Mai 09 08:27:13 sauerkraut tracd[3799586]:     return next(matches).load()
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
Mai 09 08:27:13 sauerkraut tracd[3799586]:     module = import_module(match.group('module'))
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
Mai 09 08:27:13 sauerkraut tracd[3799586]:     return _bootstrap._gcd_import(name[level:], package, level)
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "<frozen importlib._bootstrap_external>", line 790, in exec_module
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "/usr/lib/python3/dist-packages/trac/web/standalone.py", line 35, in <module>
Mai 09 08:27:13 sauerkraut tracd[3799586]:     from trac.web.auth import BasicAuthentication, DigestAuthentication
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "/usr/lib/python3/dist-packages/trac/web/auth.py", line 29, in <module>
Mai 09 08:27:13 sauerkraut tracd[3799586]:     from trac.web.chrome import Chrome, INavigationContributor
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "/usr/lib/python3/dist-packages/trac/web/chrome.py", line 40, in <module>
Mai 09 08:27:13 sauerkraut tracd[3799586]:     from trac.mimeview.api import RenderingContext, get_mimetype
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "/usr/lib/python3/dist-packages/trac/mimeview/__init__.py", line 14, in <module>
Mai 09 08:27:13 sauerkraut tracd[3799586]:     from trac.mimeview.api import *
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "/usr/lib/python3/dist-packages/trac/mimeview/api.py", line 70, in <module>
Mai 09 08:27:13 sauerkraut tracd[3799586]:     from trac.resource import Resource
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "/usr/lib/python3/dist-packages/trac/resource.py", line 21, in <module>
Mai 09 08:27:13 sauerkraut tracd[3799586]:     from trac.util.presentation import classes
Mai 09 08:27:13 sauerkraut tracd[3799586]:   File "/usr/lib/python3/dist-packages/trac/util/presentation.py", line 26, in <module>
Mai 09 08:27:13 sauerkraut tracd[3799586]:     from jinja2.utils import soft_unicode
Mai 09 08:27:13 sauerkraut tracd[3799586]: ImportError: cannot import name 'soft_unicode' from 'jinja2.utils' (/usr/lib/python3/dist-pa>

Change History (1)

comment:1 by Jens Kubieziel, 2 months ago

Resolution: fixed
Status: newclosed

Laut https://trac.edgewall.org/ticket/13404 wurde soft_unicode in soft_str umbenannt. Die Lösung ist, die Datei /usr/lib/python3/dist-packages/trac/util/presentation.py ein wenig zu patchen:

index fe5824728..82c53c86c 100644
--- a/trac/util/presentation.py
+++ b/trac/util/presentation.py
@@ -23,7 +23,10 @@ import re

 from jinja2 import Markup, Undefined, contextfilter, evalcontextfilter
 from jinja2.filters import make_attrgetter
-from jinja2.utils import soft_unicode
+try:
+    from jinja2.utils import soft_unicode
+except:
+    from markupsafe import soft_str as soft_unicode

 from trac.core import TracError
 from .datefmt import to_utimestamp, utc
Note: See TracTickets for help on using tickets.