Modify ↓
#11752 closed defect (fixed)
[Patch] (Custom query) UnicodeError: source returned bytes, but no encoding specified
Reported by: | Owned by: | Ryan J Ollos | |
---|---|---|---|
Priority: | normal | Component: | SubcomponentsPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: |
Description
when the component is enabled, on Custom query, I get the following error:
Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/trac/web/api.py", line 514, in send_error data, 'text/html') File "/usr/lib/python2.7/dist-packages/trac/web/chrome.py", line 983, in render_template stream |= self._filter_stream(req, method, filename, stream, data) File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 133, in __or__ return Stream(_ensure(function(self)), serializer=self.serializer) File "/usr/lib/python2.7/dist-packages/trac/web/chrome.py", line 1162, in inner data) File "build/bdist.linux-x86_64/egg/subcomponents/web_ui.py", line 139, in filter_stream '/chrome/subcomponents/componentselect.js"></script>') File "/usr/lib/python2.7/dist-packages/genshi/input.py", line 442, in HTML return Stream(list(HTMLParser(BytesIO(text), encoding=encoding))) File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 273, in _ensure event = stream.next() File "/usr/lib/python2.7/dist-packages/genshi/input.py", line 449, in _coalesce for kind, data, pos in chain(stream, [(None, None, None)]): File "/usr/lib/python2.7/dist-packages/genshi/input.py", line 337, in _generate raise UnicodeError("source returned bytes, but no encoding specified") UnicodeError: source returned bytes, but no encoding specified
Attachments (0)
Change History (7)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
The issue is probably seen with Genshi 0.7, similar to #11907.
I haven't reproduced the issue, but I believe the following patch would fix it:
-
subcomponents/web_ui.py
diff -r a86f0413121f subcomponents/web_ui.py
a b 134 134 stream |= Transformer("//div[@class='field'][1]").after(self._build_renamechildren_field()) 135 135 elif req.path_info.startswith('/query'): 136 136 # We need to load our script after the initializeFilters() call done by Trac 137 html = HTML('<script type="text/javascript" charset="utf-8" src="' + 138 req.href.base + 139 '/chrome/subcomponents/componentselect.js"></script>') 137 html = tag.script(type='text/javascript', charset='utf-8', 138 src=req.href.chrome('subcomponents/componentselect.js')) 140 139 stream |= Transformer('//head').append(html) 141 140 return stream
comment:4 Changed 10 years ago by
Summary: | (Custom query) UnicodeError: source returned bytes, but no encoding specified → [Patch] (Custom query) UnicodeError: source returned bytes, but no encoding specified |
---|
comment:6 Changed 8 years ago by
Owner: | changed from Frau Boonekamp to Ryan J Ollos |
---|
Note: See
TracTickets for help on using
tickets.
met this issue also in trac version 1.0.1, please fix this :(