Opened 15 years ago
Closed 11 years ago
#6904 closed defect (fixed)
Genshi UnicodeDecodeError error while rendering template (unknown template location)
Reported by: | thuffir | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | highest | Component: | TicketChartsMacro |
Severity: | blocker | Keywords: | |
Cc: | Ivanelson Nunes | Trac Release: | 0.12 |
Description (last modified by )
I have managed to install the plugin, but every time I try to call the macro I get the following error:
Trac Error Genshi UnicodeDecodeError error while rendering template (unknown template location)
Any Idea?
Attachments (0)
Change History (20)
comment:1 Changed 14 years ago by
Severity: | normal → blocker |
---|
comment:2 Changed 14 years ago by
Priority: | normal → highest |
---|
comment:3 Changed 11 years ago by
Owner: | changed from aviram to Ryan J Ollos |
---|---|
Status: | new → assigned |
comment:4 Changed 11 years ago by
Description: | modified (diff) |
---|
comment:6 Changed 11 years ago by
Trac Release: | 0.11 → 0.12 |
---|
i am also getting same error while adding macro template to wiki page. please let me know if any fix on this.
comment:8 follow-up: 10 Changed 11 years ago by
comment:9 Changed 11 years ago by
Cc: | Ivanelson Nunes added; anonymous removed |
---|
ivanelson: Have you experienced this error?
comment:10 Changed 11 years ago by
Replying to rjollos:
(In [13247]) Refs #6904: Don't cast as a string, which can cause UnicodeDecode errors.
I think that it would be simple to use to_unicode
and to_json
(untested). Also to_js_string
is available since Trac 0.12.4.
-
ticketcharts/TicketCharts.py
18 18 from trac.web.chrome import ITemplateProvider 19 19 from trac.wiki.macros import WikiMacroBase 20 20 from trac.ticket.query import Query 21 from trac.util.presentation import to_json 22 from trac.util.text import to_unicode 21 23 22 24 import openFlashChart 23 25 from openFlashChart_varieties import ( … … 185 187 return list(set(iterable)) 186 188 187 189 188 def _create_javascript_array(array_name, values, 189 function=lambda x: x and unicode(x) or ''): 190 from trac.util.text import to_js_string 191 array_values = ', '.join([to_js_string(function(value)) 192 for value in values]) 193 return 'var %s = new Array(%s)' % (array_name, array_values) 190 def _create_javascript_array(array_name, values, function=to_unicode): 191 return 'var %s = %s' % (array_name, to_json(map(function, values))) 194 192 195 193 196 194 def _create_query_object(env, query, required_columns=None):
comment:11 Changed 11 years ago by
Thanks, I'll test it out. I'm not proficient with unicode or the trac.util.text
module, so the hints are appreciated.
comment:12 Changed 11 years ago by
comment:13 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:14 follow-up: 15 Changed 11 years ago by
This bug is still reproducible for me.
I tracked it down to _get_random_string, whereas a non-utf8 string is generated. I am not sure why this happens, but my quick-and-dirty fix is to change _get_random_string
in TicketCharts.py
like that:
def _get_random_string(length): #return ''.join([random.choice(string.letters + string.digits) # for i in xrange(length)]) return str(random.randrange(111111111, 999999999))
comment:15 Changed 11 years ago by
Replying to lbolla@…:
I tracked it down to _get_random_string, whereas a non-utf8 string is generated. I am not sure why this happens, but my quick-and-dirty fix is to change
_get_random_string
inTicketCharts.py
like that:
Good catch! The behavior is caused that string.letters
is locale-dependent.
>>> locale.setlocale(locale.LC_ALL, 'de_DE') 'de_DE' >>> string.letters 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\xaa\xb5\xba\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff'
I would like to use trac.util.hex_entropy
instead of _get_random_string
. I'll fix it shortly.
comment:17 follow-up: 18 Changed 11 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Still i am getting the same error while adding macro template to wiki page.
Trac Error
Genshi UnicodeDecodeError error while rendering template (unknown template location)
Please let me whether it is fixed or any other solution?
Thanks sesha
comment:18 Changed 11 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Replying to anonymous:
Still i am getting the same error while adding macro template to wiki page.
Could you please provide the details to reproduce it? e.g. trac.log, system information, the parameters for the macro, etc....
comment:19 Changed 11 years ago by
Any idea why both comment:17 and comment:18 show ticket resolution and status change?
comment:20 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Thanks it works FINE.
same here...since thuffir is waiting for 8 months! I guess theres no hope of a fix either.