On 2024/03/25 17:08, Clemens Feige wrote:
> Here is the traceback.
> 
> Python Traceback
> File "/data/trac/python/lib/python3.11/site-packages/trac/web/main.py", line 
> 609, in dispatch_request
>     dispatcher.dispatch(req)
> File "/data/trac/python/lib/python3.11/site-packages/trac/web/main.py", line 
> 301, in dispatch
>     raise e
> File "/data/trac/python/lib/python3.11/site-packages/trac/web/main.py", line 
> 265, in dispatch
>     output = chrome.render_template(req, template, data, metadata)
> File "/data/trac/python/lib/python3.11/site-packages/trac/web/chrome.py", 
> line 1381, in render_template
>     template, data = self.prepare_template(req, filename, data, text,
> File "/data/trac/python/lib/python3.11/site-packages/trac/web/chrome.py", 
> line 1487, in prepare_template
>     domain_functions = translation.domain_functions(domain, symbols)
> File 
> "/data/trac/python/lib/python3.11/site-packages/trac/util/translation.py", 
> line 92, in domain_functions
>     return [_functions[s] for s in symbols]
> File 
> "/data/trac/python/lib/python3.11/site-packages/trac/util/translation.py", 
> line 92, in <listcomp>
>     return [_functions[s] for s in symbols]
> 
> One can also "simulate" the issue by temporarily renaming the babel
> installation directory. See attached screen shot.

Thanks for the feedback.

> Unfortunately I know only little about Python and nothing about Babel
> and thus cannot offer a patch. Shall I file a bug report?

That is an issue of Trac core since 1.4.x.
It is reproduced with Trac 1.4.4 and 1.6 without Babel.
Please report it to trac.edgewall.org/newticket.


$ python3.11 -m venv /dev/shm/trac-1.6
$ /dev/shm/trac-1.6/bin/pip install -q Trac~=1.6.0
$ /dev/shm/trac-1.6/bin/python
Python 3.11.8 (main, Feb 25 2024, 16:41:26) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import babel
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'babel'
>>> import trac
>>> trac.__version__
'1.6'
>>> from trac.test import EnvironmentStub, MockRequest
>>> from trac.web.chrome import Chrome
>>> env = EnvironmentStub()
>>> req = MockRequest(env)
>>> chrome = Chrome(env)
>>> chrome.prepare_template(req, 'layout.html', {}, domain='messages')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/dev/shm/trac-1.6/lib/python3.11/site-packages/trac/web/chrome.py", 
line 1487, in prepare_template
    domain_functions = translation.domain_functions(domain, symbols)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/dev/shm/trac-1.6/lib/python3.11/site-packages/trac/util/translation.py", line 
92, in domain_functions
    return [_functions[s] for s in symbols]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/dev/shm/trac-1.6/lib/python3.11/site-packages/trac/util/translation.py", line 
92, in <listcomp>
    return [_functions[s] for s in symbols]
            ~~~~~~~~~~^^^
KeyError: 'dgettext'
>>>


$ virtualenv -p /usr/bin/python2.7 /dev/shm/trac-1.4
$ /dev/shm/trac-1.4/bin/pip install -q Trac~=1.4.0
$ /dev/shm/trac-1.4/bin/python
Python 2.7.18 (default, Jul  1 2022, 12:27:04)
[GCC 9.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import babel
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named babel
>>> import trac
>>> trac.__version__
'1.4.4'
>>> from trac.test import EnvironmentStub, MockRequest
>>> from trac.web.chrome import Chrome
>>> env = EnvironmentStub()
>>> req = MockRequest(env)
>>> chrome = Chrome(env)
>>> chrome.prepare_template(req, 'layout.html', {}, domain='messages')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/dev/shm/trac-1.4/lib/python2.7/site-packages/trac/web/chrome.py", line 
1614, in prepare_template
    domain_functions = translation.domain_functions(domain, symbols)
  File 
"/dev/shm/trac-1.4/lib/python2.7/site-packages/trac/util/translation.py", line 
92, in domain_functions
    return [_functions[s] for s in symbols]
KeyError: 'dngettext'
>>>


-- 
Jun Omae <jun6...@gmail.com> (大前 潤)

-- 
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/a73e88de-c072-47c5-91b8-623ddd642ce4%40gmail.com.

Reply via email to