Modify ↓
#12852 closed defect (fixed)
extract_messages command failing without Genshi
| Reported by: | Jun Omae | Owned by: | Jun Omae |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.3.2 |
| Component: | i18n | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: |
Error is raised when extracting messages from Genshi template if Genshi is not installed. |
||
| Internal Changes: | |||
Description
$ /dev/shm/trac-trunk/bin/python setup.py extract_messages
...
extracting messages from trac/templates/genshi/about.html (line_comment_prefix="##", line_statement_prefix="#", trim_blocks="yes", newstyle_gettext="yes", variable_start_string="${", extensions="jinja2.ext.with_", variable_end_string="}", lstrip_blocks="yes")
Traceback (most recent call last):
File "setup.py", line 158, in <module>
**extra
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/dev/shm/trac-trunk/local/lib/python2.7/site-packages/babel/messages/frontend.py", line 467, in run
for filename, lineno, message, comments, context in extracted:
File "/dev/shm/trac-trunk/local/lib/python2.7/site-packages/babel/messages/extract.py", line 156, in extract_from_dir
dirpath=absname,
File "/dev/shm/trac-trunk/local/lib/python2.7/site-packages/babel/messages/extract.py", line 211, in check_and_call_extract_file
strip_comment_tags=strip_comment_tags
File "/dev/shm/trac-trunk/local/lib/python2.7/site-packages/babel/messages/extract.py", line 240, in extract_from_file
strip_comment_tags))
File "/dev/shm/trac-trunk/local/lib/python2.7/site-packages/babel/messages/extract.py", line 321, in extract
for lineno, funcname, messages, comments in results:
File "/home/jun66j5/src/tracdev/git/trac/dist.py", line 319, in extract_html
for m in extractor(fileobj, keywords, comment_tags, options):
TypeError: 'NoneType' object is not callable
make: *** [extract] Error 1
Python: /dev/shm/trac-trunk/bin/python
Package Version
------------------------------------------------------
Python : 2.7.6 (default, Jun 22 2015, 17:58:13)
: [GCC 4.8.2]
Setuptools : 36.0.1
Jinja2 : 2.9.6
Genshi : not installed
Babel : 2.4.0
sqlite3 : 2.6.0 (3.8.2)
PySqlite : not installed
PyMySQL : not installed
Psycopg2 : not installed
SVN bindings : not installed
Mercurial : not installed
Pygments : not installed
Textile : not installed
Pytz : 2017.2
Docutils : not installed
Twill : not installed
LXML : not installed
coverage : not installed
figleaf : not installed
Variables:
PATH=/dev/shm/trac-trunk/bin:/home/jun66j5/bin:/home/jun66j5/venv/tools/bin:/home/jun66j5/.gem/ruby/2.0.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PYTHONPATH=.
TRAC_TEST_DB_URI=
server-options= -p 3000 -a '*,/home/jun66j5/src/trac-htdigest.txt,auth' -e
External dependencies:
Git version: git version 1.9.1
Subversion version: 1.8.8
That command works with Genshi.
Attachments (0)
Change History (4)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Genshi template and i18n feature is still supported on Trac 1.3.x for Trac core and plugins. I think we should raise an error rather than skip those Genshi templates when messages extraction from Genshi templates is requested.
-
trac/dist.py
diff --git a/trac/dist.py b/trac/dist.py index ce1622aa6..868ad7343 100644
a b try: 308 308 # TODO (1.5.1) remove genshi support 309 309 if fileobj: 310 310 if 'xmlns:py="http://genshi.edgewall.org/"' in fileobj.read(): 311 if genshi: 312 if text: 313 options.update(template_class= 314 'genshi.template:NewTextTemplate') 315 extractor = genshi_extractor 311 if not genshi: 312 raise ValueError("Cannot extract messages from a legacy " 313 "Genshi template because Genshi is " 314 "unavailable.") 315 if text: 316 options.update(template_class= 317 'genshi.template:NewTextTemplate') 318 extractor = genshi_extractor 316 319 else: 317 320 extractor = jinja2_extractor 318 321 fileobj.seek(0)
comment:3 by , 8 years ago
| API Changes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
Work for me. Fixed in r16104.
comment:4 by , 8 years ago
| Owner: | set to |
|---|
Note:
See TracTickets
for help on using tickets.



Should we just skip the Genshi templates when running the extraction without Genshi installed?:
trac/dist.py