Opened 15 years ago
Closed 15 years ago
#6979 closed defect (fixed)
[Patch] Error with unicode milestone title
Reported by: | FranRuiz | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | high | Component: | WikiCalendarMacro |
Severity: | major | Keywords: | |
Cc: | FranRuiz | Trac Release: | 0.11 |
Description
If day milestone name contains any non-ascii character, the macro fails on writing it to the buffer with:
Traceback (most recent call last): File "/usr/lib/python2.6/dist-packages/trac/wiki/formatter.py", line 480, in _macro_formatter return macro.process(args, in_paragraph=True) File "/usr/lib/python2.6/dist-packages/trac/wiki/formatter.py", line 180, in process text = self.processor(text) File "/usr/lib/python2.6/dist-packages/trac/wiki/formatter.py", line 167, in _macro_processor text) File "/var/trac/test-erp/plugins/WikiCalendarMacro.py", line 283, in expand_macro 'day': day UnicodeEncodeError: ('ascii', u'\n<td><a class="day milestone" href="/test/wiki/Meeting/2010/01/21?action=edit" title="Milestone: Primera iteraci\xf3n - Create page Meeting/2010/01/21">21</a></td>', 120, 121, 'ordinal not in range(128)')
Attachments (1)
Change History (12)
Changed 15 years ago by
Attachment: | patch.diff added |
---|
comment:1 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 follow-up: 4 Changed 15 years ago by
I went ahead and applied the patch. I haven't had time to test after applying the patch. Would you be willing to test the latest version of the trunk?
comment:3 Changed 15 years ago by
Also, please go ahead and list your name in the list of Contributors on the wiki page, if you like.
comment:4 follow-up: 8 Changed 15 years ago by
Replying to rjollos:
I went ahead and applied the patch. I haven't had time to test after applying the patch. Would you be willing to test the latest version of the trunk?
It worked for me but I'll test the trunk version as soon as I can.
comment:5 follow-up: 7 Changed 15 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
r7891 looks wrong to me - surely it should be title.encode('utf-8') ?
With the current version, I'm seeing "'str' object has no attribute 'unicode'" errors.
comment:6 follow-up: 9 Changed 15 years ago by
Assuming that the patch author generated the patch from a working version and it was working for him, I'd have to guess that this is dependent on the version of Python you're using. Just a guess though ...
comment:7 Changed 15 years ago by
Replying to neil@dip.sun.ac.za:
r7891 looks wrong to me - surely it should be title.encode('utf-8') ?
I think that according to trac:TracUnicode it's a good idea to use UTF-8 encoding.
With the current version, I'm seeing "'str' object has no attribute 'unicode'" errors.
It would be useful to know which version of Python and system locale are you using.
comment:8 Changed 15 years ago by
comment:9 Changed 15 years ago by
Replying to rjollos:
Assuming that the patch author generated the patch from a working version and it was working for him, I'd have to guess that this is dependent on the version of Python you're using.
The patch attached to this ticket uses title.encode, so I'm not sure were the unicode method used in r7891 came from.
I'm not aware of any version of python which has a unicode method on string objects.
For reference, this fails with both python 2.5 and 2.6 here (trac 0.11.5 in both cases).
comment:10 Changed 15 years ago by
Stupid mistake on my part ... caused by drinking and patching. I'll fix it in a moment. Thanks for catching this.
comment:11 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Patch that encodes milestone title in utf-8