Modify ↓
#12886 closed defect (fixed)
UnicodeError: source returned bytes, but no encoding specified
Reported by: | Owned by: | Kirk | |
---|---|---|---|
Priority: | normal | Component: | BudgetingPlugin |
Severity: | critical | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description (last modified by )
The stack trace looks like this:
File "/usr/local/lib/python2.7/dist-packages/trac/web/main.py", line 562, in _dispatch_request dispatcher.dispatch(req) File "/usr/local/lib/python2.7/dist-packages/trac/web/main.py", line 269, in dispatch iterable=chrome.use_chunked_encoding) File "/usr/local/lib/python2.7/dist-packages/trac/web/chrome.py", line 1079, in render_template stream |= self._filter_stream(req, method, filename, stream, data) File "/usr/local/lib/python2.7/dist-packages/genshi/core.py", line 133, in __or__ return Stream(_ensure(function(self)), serializer=self.serializer) File "/usr/local/lib/python2.7/dist-packages/trac/web/chrome.py", line 1331, in inner data) File "build/bdist.linux-x86_64/egg/ticketbudgeting/ticketbudgeting.py", line 327, in filter_stream stream |= Transformer('.//fieldset [@id="properties"]').after(HTML(fieldset)) File "/usr/local/lib/python2.7/dist-packages/genshi/input.py", line 442, in HTML return Stream(list(HTMLParser(BytesIO(text), encoding=encoding))) File "/usr/local/lib/python2.7/dist-packages/genshi/core.py", line 273, in _ensure event = stream.next() File "/usr/local/lib/python2.7/dist-packages/genshi/input.py", line 449, in _coalesce for kind, data, pos in chain(stream, [(None, None, None)]): File "/usr/local/lib/python2.7/dist-packages/genshi/input.py", line 337, in _generate raise UnicodeError("source returned bytes, but no encoding specified")
This error should be caused by a missing adaptation for Genshi 0.7, the attached patch should solve the problem.
Attachments (1)
Change History (8)
Changed 8 years ago by
Attachment: | ticketbudgeting.py.diff added |
---|
comment:1 Changed 8 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 8 years ago by
comment:3 Changed 8 years ago by
I don't think the patch fixes it. The patch would just change fieldset
variable to u'fieldset'
literal. It breaks the plugin features.
- stream |= Transformer('.//fieldset [@id="properties"]').after(HTML(fieldset)) + stream |= Transformer('.//fieldset [@id="properties"]').after(HTML(u"""fieldset"""))
I'll post a patch later.
comment:4 Changed 8 years ago by
Well, I am neither an experienced python coder nor have I used Genshi so far. I simply tried to silence the error above. So, presumable you are right - nevertheless, I would really be interested in a fix; it would be great if you could post a patch. Thanks!
comment:5 Changed 8 years ago by
Index: ticketbudgeting/ticketbudgeting.py =================================================================== --- ticketbudgeting/ticketbudgeting.py (revision 16144) +++ ticketbudgeting/ticketbudgeting.py (working copy) @@ -359,7 +351,7 @@ if 'by' in req.args: by = req.args['by'] budget_stats, stats_by = self._get_milestone_html(req, by) - stats_by = "<fieldset><legend>Budget</legend><table>%s</table></fieldset>" % stats_by + stats_by = u"""<fieldset><legend>Budget</legend><table>%s</table></fieldset>""" % stats_by stream |= Transformer('//form[@id="stats"]').append(HTML(stats_by)) stream |= Transformer('//div[@class="info"]').append(HTML(budget_stats)) return stream
comment:7 Changed 8 years ago by
Owner: | changed from Franz to Kirk |
---|
Feel free to push a better fix, but this at least fixes the acute problem.
Note: See
TracTickets for help on using
tickets.
was bitten by this bug as well, and the attached patch helped. would like to see it integrated into Budgeting Plugin trunk