Opened 9 years ago
Closed 9 years ago
#12375 closed defect (fixed)
Unicode character in ticket summary broken decoding in timeline
Reported by: | Owned by: | falkb | |
---|---|---|---|
Priority: | normal | Component: | SimpleMultiProjectPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description
As described in http://trac.edgewall.org/ticket/12092#comment:8...
SimpleMultiProjectPlugin is breaking the unicode decoding of the timeline view. Using '&' in ticket summaries results in '&' in the timeline.
This is trac 1.0.5 and SimpleMultiProject svn trunk.
Attachments (1)
Change History (18)
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
Sorry, I never used a '&' character before in some summary. The original ticket already described the part of MultiProjectPlugin doing the wrong (?) decoding: simplemultiprojectplugin/trunk/simplemultiproject/timeline.py@14000:96#L86
comment:3 Changed 9 years ago by
Thanks for the hint. I think I can reproduce it. Though need to find the time for debugging and fixing. I remember that puzzle was quite tricky there. If someone is faster than me, I'll appreciate the patch.
comment:4 Changed 9 years ago by
Status: | new → accepted |
---|
Please, could you try this patch and report back?:
-
timeline.py
8 8 from trac.ticket.model import Ticket 9 9 from simplemultiproject.model import * 10 10 from trac.util.text import to_unicode 11 from trac.util.html import unescape 11 12 from trac.core import * 12 13 from trac.web.api import IRequestFilter, ITemplateStreamFilter 13 14 from operator import itemgetter … … 98 99 ticket_no = splitted_output[0].split('>') 99 100 if len(tooltip) == 3: #it's a ticket 100 101 #now rebuild the puzzle by inserting the name 101 output = tag('Ticket' + ' ', tag.em(ticket_no[1], title=tooltip[1]), ' ', tag.span(self._current_project[self._read_idx], style="background-color: #ffffd0;"), splitted_output[1])102 output = tag('Ticket' + ' ', tag.em(ticket_no[1], title=tooltip[1]), ' ', tag.span(self._current_project[self._read_idx], style="background-color: #ffffd0;"), unescape(splitted_output[1])) 102 103 elif len(tooltip) == 1 and len(splitted_output) == 3: #it's an attachment 103 104 output += tag(' ', tag.span(self._current_project[self._read_idx], style="background-color: #ffffd0;")) 104 105 return output
comment:5 Changed 9 years ago by
No, that did not help. The splitted_output seems to already have the wrong encoding.
comment:6 Changed 9 years ago by
I'm just thinking, not at the test bench at the moment. What about this?:
splitted_output = unescape(to_unicode(output)).split("</em>")
comment:7 Changed 9 years ago by
No. I also tried some mutations of to_unicode and unescape, but it did not help.
Changed 9 years ago by
Attachment: | ticket-summary.png added |
---|
comment:8 Changed 9 years ago by
Hmmm, now I got access to the test bench and my second patch (comment:6) works well for me. See
comment:9 Changed 9 years ago by
Did you really restart the webserver with the new plugin version? Otherwise I need such "bad" ticket summary for testing.
comment:10 Changed 9 years ago by
While being new to Trac development, I'm sure I reloaded the plugin. Writing some
output = tag('FOO-Ticket' + ' ',
rebuilding the egg, copy to the ./plugins folder and restarting the uWSGI processes (not the webserver) results in the FOO-Ticket in the timeline.
Currently I have that state:
-
simplemultiproject/timeline.py
old new 8 8 from trac.ticket.model import Ticket 9 9 from simplemultiproject.model import * 10 10 from trac.util.text import to_unicode 11 from trac.util.html import unescape 11 12 from trac.core import * 12 13 from trac.web.api import IRequestFilter, ITemplateStreamFilter 13 14 from operator import itemgetter … … 93 94 94 95 if field == 'title': #now it's time to insert the project name 95 96 #split the whole string until we can insert 96 splitted_output = to_unicode(output).split("</em>")97 splitted_output = unescape(to_unicode(output).split("</em>")) 97 98 tooltip = splitted_output[0].split('\"') 98 99 ticket_no = splitted_output[0].split('>') 99 100 if len(tooltip) == 3: #it's a ticket
I also tried a combination of the 2 patches.
I still have 'test & unicode testing' as summary in the ticket and 'test & unicode testing)' in the timeline.
comment:11 Changed 9 years ago by
Hi Massimo, please test this one (based on the SVN version):
-
timeline.py
8 8 from trac.ticket.model import Ticket 9 9 from simplemultiproject.model import * 10 10 from trac.util.text import to_unicode 11 from trac.util.html import Markup, unescape 11 12 from trac.core import * 12 13 from trac.web.api import IRequestFilter, ITemplateStreamFilter 13 14 from operator import itemgetter … … 98 99 ticket_no = splitted_output[0].split('>') 99 100 if len(tooltip) == 3: #it's a ticket 100 101 #now rebuild the puzzle by inserting the name 101 output = tag('Ticket' + ' ', tag.em(ticket_no[1], title=tooltip[1]), ' ', tag.span(self._current_project[self._read_idx], style="background-color: #ffffd0;"), splitted_output[1]) 102 ticket_summary = unescape(Markup(tooltip[1])) 103 msg_text = unescape(Markup(splitted_output[1])) 104 proj = self._current_project[self._read_idx] 105 output = tag('Ticket' + ' ', tag.em(ticket_no[1], title=ticket_summary), ' ', tag.span(proj, style="background-color: #ffffd0;"), msg_text) 102 106 elif len(tooltip) == 1 and len(splitted_output) == 3: #it's an attachment 103 107 output += tag(' ', tag.span(self._current_project[self._read_idx], style="background-color: #ffffd0;")) 104 108 return output
comment:14 Changed 9 years ago by
Keywords: | testing added |
---|
comment:15 Changed 9 years ago by
comment:16 Changed 9 years ago by
Thanks. The same here. I keep it open for a general testing period to see if people see issues with this change. Will close it in about 3 weeks.
comment:17 Changed 9 years ago by
Keywords: | testing removed |
---|---|
Resolution: | → fixed |
Status: | accepted → closed |
Testing period over. No issues in a running production system.
Is this a new effect or does it happen since a certain revision?