Modify

Opened 10 years ago

Closed 8 years ago

Last modified 8 years ago

#11752 closed defect (fixed)

[Patch] (Custom query) UnicodeError: source returned bytes, but no encoding specified

Reported by: armandocroce@… 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 anonymous

met this issue also in trac version 1.0.1, please fix this :(

comment:2 Changed 10 years ago by Ryan J Ollos

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  
    134134                    stream |= Transformer("//div[@class='field'][1]").after(self._build_renamechildren_field())
    135135        elif req.path_info.startswith('/query'):
    136136            # 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'))
    140139            stream |= Transformer('//head').append(html)
    141140        return stream

comment:3 Changed 10 years ago by anonymous

thanks for you solution, it woks well :(

comment:4 Changed 10 years ago by Ryan J Ollos

Summary: (Custom query) UnicodeError: source returned bytes, but no encoding specified[Patch] (Custom query) UnicodeError: source returned bytes, but no encoding specified

comment:5 Changed 8 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

In 15656:

1.2.1: Fix UnicodeError on query page

Fixes #11752.

comment:6 Changed 8 years ago by Ryan J Ollos

Owner: changed from Frau Boonekamp to Ryan J Ollos

comment:7 Changed 8 years ago by Ryan J Ollos

In 15657:

1.2.1: Addendum to r15656

The change was unintentionally omitted.

Refs #11752.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
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.