Modify ↓
Opened 17 years ago
Closed 17 years ago
#5405 closed defect (fixed)
Non-ascii wiki page names broken
Reported by: | yura ivanov | Owned by: | Christian Boos |
---|---|---|---|
Priority: | normal | Milestone: | 0.11 |
Component: | wiki system | Version: | devel |
Severity: | major | Keywords: | python25 |
Cc: | ivanov@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
With current trunk (Trac 0.11dev-r5557) there is a problem with non-ascii wiki pages.
Traceback (most recent call last): File "d:\python25\lib\site-packages\trac-0.11dev_r5557-py2.5.egg\trac\web\api.py", line 336, in send_error 'text/html') File "d:\python25\lib\site-packages\trac-0.11dev_r5557-py2.5.egg\trac\web\chrome.py", line 590, in render_template return stream.render(method, doctype=doctype) File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\core.py", line 152, in render output = u''.join(list(generator)) File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\output.py", line 182, in __call__ for kind, data, pos in stream: File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\output.py", line 427, in __call__ for kind, data, pos in stream: File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\output.py", line 587, in __call__ for kind, data, pos in chain(stream, [(None, None, None)]): File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\output.py", line 367, in __call__ for ev in stream: File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\core.py", line 221, in _ensure for event in stream: File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\core.py", line 221, in _ensure for event in stream: File "d:\python25\lib\site-packages\trac-0.11dev_r5557-py2.5.egg\trac\web\chrome.py", line 622, in _strip_accesskeys for kind, data, pos in stream: File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\core.py", line 221, in _ensure for event in stream: File "d:\python25\lib\site-packages\trac-0.11dev_r5557-py2.5.egg\trac\web\chrome.py", line 611, in _generate for kind, data, pos in stream: File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\template\markup.py", line 246, in _include for event in stream: File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\template\markup.py", line 316, in _match content = list(self._include(content, ctxt)) File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\template\markup.py", line 246, in _include for event in stream: File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\template\markup.py", line 291, in _match for event in stream: File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\template\markup.py", line 280, in _strip event = stream.next() File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\template\markup.py", line 236, in _exec for event in stream: File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\template\base.py", line 420, in _eval result = data.evaluate(ctxt) File "D:\Python25\lib\site-packages\genshi-0.4-py2.5.egg\genshi\template\eval.py", line 136, in evaluate return eval(self.code, _globals, {'data': data}) File "D:\Python25\lib\site-packages\trac-0.11dev_r5557-py2.5.egg\trac\templates\error.html", line 161, in <Expression u'shorten_line(repr(value))'> <td><code>${shorten_line(repr(value))}</code></td> UnicodeEncodeError: 'ascii' codec can't encode characters in position 20-23: ordinal not in range(128)
Same problem if wiki page contains link to non-ascii wiki page like [wiki:тест]
At r5444 everything was fine.
Attachments (0)
Change History (6)
comment:1 by , 17 years ago
Keywords: | python25 added |
---|
comment:2 by , 17 years ago
I modified context.py but not sure all is correct (not python programmer, sry), but it works :) Thanx.
comment:3 by , 17 years ago
I've the same problem after inserting an accent in a wiki page.
Can you explain what to modify in the file ?
comment:4 by , 17 years ago
Try like that:
-
trac/context.py
134 134 detail += ' [abs]' 135 135 if self._resource: 136 136 detail += ' %r' % self._resource 137 return '<Context % s%s%s>' % \137 return '<Context %r%s%s>' % \ 138 138 (', '.join(reversed(path)), 139 139 self.req and ' %r' % self.req or '', detail) 140 140
comment:6 by , 17 years ago
Resolution: | → fixed |
---|---|
Severity: | blocker → major |
Status: | new → closed |
The problem should be fixed in r5646.
Note:
See TracTickets
for help on using tickets.
Yeah, I've seen something similar with non-ascii attachments as well, I believe it's a Python 2.5 issue.
I've not yet tracked it down completely, but you can try the following workaround which worked for me: change the
WikiContext.__repr__
in source:trunk/trac/context.py to use exclusively '%r' in string formats.