Ticket #9197 (new defect)
Opened 22 months ago
Last modified 17 months ago
trac search pops internal error: "KeyError: u'Path'" when language = zh_CN
| Reported by: | lranfolder@… | Owned by: | cboos |
|---|---|---|---|
| Priority: | low | Milestone: | next-minor-0.12.x |
| Component: | i18n | Version: | 0.12dev |
| Severity: | normal | Keywords: | i18n, zh-CN, search, KeyError, genshi, weird |
| Cc: | palgarvio | ||
| Release Notes: | |||
| API 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
Change History
comment:1 Changed 22 months ago by cboos
- Owner set to cboos
comment:2 Changed 22 months ago by lranfolder@…
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.
comment:3 follow-up: ↓ 4 Changed 22 months ago by anonymous
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 in reply to: ↑ 3 Changed 22 months ago by lranfolder@…
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?
comment:5 follow-up: ↓ 6 Changed 22 months ago by cboos
No. That frame just happens to reference the templateNotFound exception, that's all.
Look rather at the last 2 frames.
comment:6 in reply to: ↑ 5 Changed 22 months ago by lranfolder@…
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' |
comment:7 follow-up: ↓ 9 Changed 22 months ago by cboos
Ok, the first two then, according to your preferred direction ;-)
The ones involving i18n.py actually.
comment:8 Changed 22 months ago by anonymous
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 in reply to: ↑ 7 Changed 22 months ago by lranfolder@…
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 Changed 22 months ago by cboos
- Cc palgarvio 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.
comment:11 Changed 17 months ago by cboos
- Keywords KeyError, genshi, weird added; 0.12dev, KeyError removed
- Milestone changed from 0.12.1 to next-minor-0.12.x
- Priority changed from normal to low
Not sure what we can do here.



Are you sure your catalog is up to date? (see 0.12/TracInstall#InstallingTrac compile_catalog step).