Opened 15 years ago
Closed 12 years ago
#9197 closed defect (cantfix)
trac search pops internal error: "KeyError: u'Path'" when language = zh_CN
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | i18n | Version: | 0.12dev |
Severity: | normal | Keywords: | i18n, zh-CN, search, KeyError, genshi, weird |
Cc: | Pedro Algarvio, aka, s0undt3ch | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I'm setting an Apache+SVN+Trac enviroment for our project, use mod_python to integrate trac into apache.
System Information:
Trac 0.12dev-r9405 Babel 0.9.4 Docutils 0.6 Genshi 0.6dev-r1096 mod_python 3.3.1 Pygments 1.3.1 pysqlite 2.3.2 Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] pytz 2010g setuptools 0.6c11 SQLite 3.3.4 Subversion 1.6.6 (r40053) jQuery: 1.4.2
My default language is Simplified Chinese, localization just fine, most of functions fine, but when I try to search something, Trac internal error "KeyError: u'path'" pops, then I set language to US English, then search works fine, set language back to default, error again.
Python Traceback:
文件 "build/bdist.win32/egg/trac/web/main.py", 行 514, 于 _dispatch_request文件 "build/bdist.win32/egg/trac/web/main.py", 行 257, 于 dispatch文件 "build/bdist.win32/egg/trac/web/chrome.py", 行 862, 于 render_template文件 "build/bdist.win32/egg/genshi/core.py", 行 183, 于 render文件 "build/bdist.win32/egg/genshi/output.py", 行 58, 于 encode文件 "build/bdist.win32/egg/genshi/output.py", 行 339, 于 __call__文件 "build/bdist.win32/egg/genshi/output.py", 行 826, 于 __call__文件 "build/bdist.win32/egg/genshi/output.py", 行 670, 于 __call__文件 "build/bdist.win32/egg/genshi/output.py", 行 771, 于 __call__文件 "build/bdist.win32/egg/genshi/output.py", 行 586, 于 __call__文件 "build/bdist.win32/egg/genshi/core.py", 行 288, 于 _ensure文件 "build/bdist.win32/egg/genshi/core.py", 行 288, 于 _ensure文件 "build/bdist.win32/egg/trac/web/chrome.py", 行 966, 于 _strip_accesskeys文件 "build/bdist.win32/egg/genshi/core.py", 行 288, 于 _ensure文件 "build/bdist.win32/egg/trac/web/chrome.py", 行 955, 于 _generate文件 "build/bdist.win32/egg/genshi/template/base.py", 行 592, 于 _include文件 "build/bdist.win32/egg/genshi/template/markup.py", 行 381, 于 _match文件 "build/bdist.win32/egg/genshi/template/markup.py", 行 381, 于 _match文件 "build/bdist.win32/egg/genshi/template/markup.py", 行 330, 于 _match文件 "build/bdist.win32/egg/genshi/template/base.py", 行 532, 于 _flatten文件 "build/bdist.win32/egg/genshi/core.py", 行 288, 于 _ensure文件 "build/bdist.win32/egg/genshi/path.py", 行 588, 于 _generate文件 "build/bdist.win32/egg/genshi/template/base.py", 行 592, 于 _include文件 "build/bdist.win32/egg/genshi/template/markup.py", 行 319, 于 _strip文件 "build/bdist.win32/egg/genshi/template/base.py", 行 532, 于 _flatten文件 "build/bdist.win32/egg/genshi/core.py", 行 288, 于 _ensure文件 "build/bdist.win32/egg/genshi/path.py", 行 588, 于 _generate文件 "build/bdist.win32/egg/genshi/template/base.py", 行 592, 于 _include文件 "build/bdist.win32/egg/genshi/template/markup.py", 行 319, 于 _strip文件 "build/bdist.win32/egg/genshi/template/base.py", 行 532, 于 _flatten文件 "build/bdist.win32/egg/genshi/filters/i18n.py", 行 172, 于 _generate文件 "build/bdist.win32/egg/genshi/filters/i18n.py", 行 1048, 于 translate文件 "build/bdist.win32/egg/genshi/filters/i18n.py", 行 1018, 于 yield_parts
I try to reinstall several times, just same, then I try to search, found nothing. So, maybe that is a problem, am I right?
Attachments (0)
Change History (12)
comment:1 by , 15 years ago
Owner: | set to |
---|
comment:2 by , 15 years ago
yep, first I didn't do that, the localization not work, and trac pops error like couldn't find zh_CN things, after I did compile_catalog step just like you said, and reinstalled, the ui language turned to Chinese, and worked, but the search not worked.
follow-up: 4 comment:3 by , 15 years ago
I can't reproduce the error, sorry. I need more details: log in as a user with TRAC_ADMIN permissions where you have an advanced error display mode where you can find more information in the backtrace, by looking at the local variables (see also #9171 for a similar error and how we managed to find the cause).
comment:4 by , 15 years ago
Replying to cboos:
I can't reproduce the error, sorry. I need more details: log in as a user with TRAC_ADMIN permissions where you have an advanced error display mode where you can find more information in the backtrace, by looking at the local variables (see also #9171 for a similar error and how we managed to find the cause).
There is some detail, when I was digging into the python trace, and click into
文件 "build/bdist.win32/egg/genshi/template/base.py", 行 592, 于 _include
The details like this:
局部变量:
名称 | 值 |
templateNotFound | <class 'genshi.template.loader.templateNotFound'> |
ctxt | [{'result': {'date': u'2010-4-1 17:12:27', 'href': '/trac/wiki/WikiStart', … |
event | ('TEXT', u'\u67e5\u770b ', (None, -1, -1)) |
self | <markupTemplate "search.html"> |
stream | <itertools.chain object at 0x032107B0> |
vars | {} |
So I think maybe that is the problem, something about localization caused the template couldn't be found, is that right?
follow-up: 6 comment:5 by , 15 years ago
No. That frame just happens to reference the templateNotFound exception, that's all. Look rather at the last 2 frames.
comment:6 by , 15 years ago
Replying to cboos:
No. That frame just happens to reference the templateNotFound exception, that's all. Look rather at the last 2 frames.
Thanks for help, here they are:
文件 "build/bdist.win32/egg/trac/web/main.py", 行 514, 于 _dispatch_request
局部变量:
名称 | 值 |
dispatcher | <trac.web.main.RequestDispatcher object at 0x02791930> |
e | KeyError(u'path',) |
env | <trac.env.Environment object at 0x021C1050> |
env_error | None |
exc_info | (<type 'exceptions.KeyError'>, KeyError(u'path',), <traceback object at … |
faulty_plugins | [] |
frames | [] |
has_admin | True |
message | u"KeyError: u'path'" |
plugins | [] |
req | <Request "GET '/search'"> |
resp | [] |
th | 'http://trac-hacks.org' |
traceback | u'Traceback (most recent call last):\n File … |
tracker | 'http://trac.edgewall.org' |
文件 "build/bdist.win32/egg/trac/web/main.py", 行 257, 于 dispatch
局部变量:
名称 | 值 |
chosen_handler | <trac.search.web_ui.SearchModule object at 0x02791AD0> |
chrome | <trac.web.chrome.Chrome object at 0x02791550> |
content_type | None |
data | {'dateinfo': <function dateinfo at 0x03A054B0>, 'page_href': … |
err | (<type 'exceptions.KeyError'>, KeyError(u'path',), <traceback object at … |
handler | <trac.search.web_ui.SearchModule object at 0x02791AD0> |
req | <Request "GET '/search'"> |
resp | ('search.html', {'dateinfo': <function dateinfo at 0x03A054B0>, … |
self | <trac.web.main.RequestDispatcher object at 0x02791930> |
template | 'search.html' |
follow-up: 9 comment:7 by , 15 years ago
Ok, the first two then, according to your preferred direction ;-) The ones involving i18n.py actually.
comment:8 by , 15 years ago
3ks first :), and can you give me some advises to debug this problem? If I can trace into the procedures of that, and watch the runtime states, maybe I can locate where the exact problem is. I'm not familliar with Apache & Python things, It's almost the first time I use them, so, thanks for any helps.
comment:9 by , 15 years ago
Replying to cboos:
Ok, the first two then, according to your preferred direction ;-) The ones involving i18n.py actually.
Oh, fool me…, then the last 2 here, sorry, ;-)
文件 "build/bdist.win32/egg/genshi/filters/i18n.py", 行 1048, 于 translate
局部变量:
名称 | 值 |
event | ('TEXT', u'By ', … |
events | [('TEXT', u'By ', … |
order | 0 |
part | ('TEXT', u'\u67e5\u770b ', (None, -1, -1)) |
parts | [] |
parts_counter | {0: []} |
regex | <_sre.SRE_Pattern object at 0x0207CC60> |
self | <genshi.filters.i18n.MessageBuffer object at 0x0394E1D0> |
string | u'\u67e5\u770b %(path)s' |
substream | None |
yield_parts | <function yield_parts at 0x03A0C9B0> |
文件 "build/bdist.win32/egg/genshi/filters/i18n.py", 行 1018, 于 yield_parts
局部变量:
名称 | 值 |
idx | 1 |
part | u'path' |
regex | <_sre.SRE_Pattern object at 0x0207CC60> |
self | <genshi.filters.i18n.MessageBuffer object at 0x0394E1D0> |
string | u'\u67e5\u770b %(path)s' |
comment:10 by , 15 years ago
Cc: | added |
---|
Strange, u'\u67e5\u770b %(path)s'
corresponds to the following part of the catalog:
#: trac/wiki/templates/wiki_view.html:26 #, python-format msgid "View %(path)s" msgstr "查看 %(path)s"
No idea how this can occur in the search.html template, near the "By " fragment.
follow-up: 12 comment:11 by , 14 years ago
Keywords: | genshi weird added; 0.12dev removed |
---|---|
Milestone: | 0.12.1 → next-minor-0.12.x |
Priority: | normal → low |
Not sure what we can do here.
comment:12 by , 12 years ago
Milestone: | next-minor-0.12.x |
---|---|
Resolution: | → cantfix |
Status: | new → closed |
Are you sure your catalog is up to date? (see 0.12/TracInstall#InstallingTrac
compile_catalog
step).