Edgewall Software
Modify

Opened 18 years ago

Closed 18 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 Christian Boos, 18 years ago

Keywords: python25 added

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.

comment:2 by yura ivanov, 18 years ago

I modified context.py but not sure all is correct (not python programmer, sry), but it works :) Thanx.

comment:3 by anonymous, 18 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 Christian Boos, 18 years ago

Try like that:

  • trac/context.py

     
    134134            detail += ' [abs]'
    135135        if self._resource:
    136136            detail += ' %r' % self._resource
    137         return '<Context %s%s%s>' % \
     137        return '<Context %r%s%s>' % \
    138138               (', '.join(reversed(path)),
    139139                self.req and ' %r' % self.req or '', detail)
    140140   

comment:5 by Christian Boos, 18 years ago

Hm, not that simple. The '%r' % self.req part is also failing…

comment:6 by Christian Boos, 18 years ago

Resolution: fixed
Severity: blockermajor
Status: newclosed

The problem should be fixed in r5646.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.