Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10989 closed defect (fixed)

UnicodeEncodeError with Genshi 0.7

Reported by: ykrocku@… Owned by: falkb
Priority: high Component: SimpleMultiProjectPlugin
Severity: critical Keywords: genshi 0.7
Cc: Trac Release: 1.0

Description

Error callstack

Trac detected an internal error: UnicodeEncodeError: 'ascii' codec can't encode characters in position 227-230: ordinal not in range(128)

Most recent call last:
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/main.py", line 497, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/main.py", line 233, in dispatch
  content_type)
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/chrome.py", line 983, in render_template
  stream |= self._filter_stream(req, method, filename, stream, data)
File "/usr/local/lib/python2.7/dist-packages/Genshi-0.7-py2.7-linux-i686.egg/genshi/core.py", line 133, in __or__
  return Stream(_ensure(function(self)), serializer=self.serializer)
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/chrome.py", line 1162, in inner
  data)
File "/usr/local/lib/python2.7/dist-packages/SimpleMultiProject-0.0.3dev-py2.7.egg/simplemultiproject/roadmap.py", line 195, in filter_stream
  div_milestones_array = self.__extract_div_milestones_array('<div class="milestone">',stream_milestones)
File "/usr/local/lib/python2.7/dist-packages/SimpleMultiProject-0.0.3dev-py2.7.egg/simplemultiproject/roadmap.py", line 108, in __extract_div_milestones_array
  html_milestones = str(stream_milestones)

I believe this error is caused by this changeset http://genshi.edgewall.org/changeset/1140

I try to call stream_milestones.render() instead of str(stream_milestones)

html_milestones = str(stream_milestones)
html_milestones = stream_milestones.render()

And this fix this probelm

System Information

Package	Version
Trac	1.0.1
Babel	0.9.6
Docutils	0.7
Genshi	0.7 (without speedups)
mod_wsgi	3.3 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
Pygments	1.4
pysqlite	2.6.0
Python	2.7.2+ (default, Oct 4 2011, 20:29:37) [GCC 4.6.1]
pytz	2010b
setuptools	0.6
SQLite	3.7.7
Subversion	1.6.12 (r955767)
jQuery	1.7.2

Attachments (0)

Change History (6)

comment:1 Changed 12 years ago by falkb

Owner: changed from Christopher Paredes to falkb

comment:2 Changed 12 years ago by falkb

Status: newassigned

Thanks. Applying this patch it still works for me, too. My question is to you: Is render() available for older versions or could it break something?

comment:3 Changed 12 years ago by Ryan J Ollos

I think you should be okay to call render:

comment:4 Changed 12 years ago by falkb

Resolution: fixed
Status: assignedclosed

In 13138:

Fixed #10989: call render() instead of str() in __extract_div_milestones_array() to avoid UnicodeEncodeError (Thanks to ykrocku for the patch and rjollos for reviewing).

Last edited 12 years ago by Ryan J Ollos (previous) (diff)

comment:5 Changed 12 years ago by Ryan J Ollos

Keywords: genshi 0.7 added

Similar issue in #11145.

comment:6 Changed 12 years ago by Ryan J Ollos

Similar issue in #11133.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain falkb.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.