Roadmap page results in error whith SimpleMultiProject plugin and Trac 1.0

62 views
Skip to first unread message

oneman

unread,
Nov 6, 2015, 1:58:03 AM11/6/15
to Trac Users
Hi,

I installed trac 1.0 on debian jessie. It worked fine. After I installed the latest version of SimpleMultiProject plugin, the Roadmap page doesn't render anymore. The error mentions "source returned bytes, but no encoding specified", but I can't understand what causes the error or how to go about solving it.

Any hint welcome.

The error report:

==== How to Reproduce ====

While doing a GET operation on `/roadmap`, Trac issued an internal error.

User agent: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/601.2.7 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.7`

==== System Information ====
|| '''`Trac`''' || `1.0.2` ||
|| '''`Babel`''' || `1.3` ||
|| '''`CustomFieldAdmin`''' || `0.2.6` ||
|| '''`Docutils`''' || `0.12` ||
|| '''`Genshi`''' || `0.7 (with speedups)` ||
|| '''`GIT`''' || `2.1.4` ||
|| '''`mod_wsgi`''' || `4.3.0 (WSGIProcessGroup  WSGIApplicationGroup %{GLOBAL})` ||
|| '''`Pygments`''' || `2.0.1` ||
|| '''`pysqlite`''' || `2.6.0` ||
|| '''`Python`''' || `2.7.9 (default, Mar  1 2015, 13:01:26) ` [[br]] `[GCC 4.9.2]` ||
|| '''`pytz`''' || `2012c` ||
|| '''`setuptools`''' || `5.5.1` ||
|| '''`SQLite`''' || `3.8.7.1` ||
|| '''`Subversion`''' || `1.8.10 (r1615264)` ||
|| '''`jQuery`''' || `1.7.2` ||
|| '''`jQuery UI`''' || `1.10.1` ||
|| '''`jQuery Timepicker`''' || `1.2` ||

==== Enabled Plugins ====
|| '''`NavAdd`''' || `0.3` ||
|| '''`SimpleMultiProject`''' || `0.5.1dev` ||
|| '''`Trac-jsGantt`''' || `0.9` ||
|| '''`TracCustomFieldAdmin`''' || `0.2.6` ||
|| '''`TracMasterTickets`''' || `3.0.2` ||
|| '''`TracSubTicketsPlugin`''' || `0.1.1.dev-20120115` ||

==== Python Traceback ====
{{{
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 512, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 240, in dispatch
    content_type)
  File "/usr/lib/python2.7/dist-packages/trac/web/chrome.py", line 1009, 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 1192, in inner
    data)
  File "build/bdist.linux-x86_64/egg/simplemultiproject/roadmap.py", line 113, in filter_stream
    stream = stream | filter_.replace(HTML('<label for="showcompleted">Show completed milestones and '
  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
}}}

RjOllos

unread,
Nov 6, 2015, 8:28:52 AM11/6/15
to Trac Users
Also reported in:

Downgrading to Genshi 0.6.x might work around the issue.

- Ryan 

oneman

unread,
Nov 6, 2015, 11:17:28 AM11/6/15
to Trac Users
Thanks, I'll see if that helps and report back

F@lk

unread,
Nov 9, 2015, 3:41:31 AM11/9/15
to Trac Users
Hi!
See my comment in https://trac-hacks.org/ticket/12568#comment:4
CU, falkb

oneman

unread,
Nov 9, 2015, 4:42:54 AM11/9/15
to Trac Users
Great! That solved the issue. It resulted in another issue however. Trac complained: 

"Cannot find implementation(s) of the IPermissionPolicy interface named ProjectTicketsPolicy. Please check that the Component is enabled or update the option [trac] permission_policies in trac.ini." 

After I disabled ProjectTicketsPolicy it all worked fine and I don't need ProjectTicketsPolicy functionality anyhow. I guess it's unrelated.

oneman

unread,
Nov 9, 2015, 4:50:39 AM11/9/15
to Trac Users
Aww, replied to early. The roadmap page renders, but falls back to the original format without project selection...

oneman

unread,
Nov 9, 2015, 8:26:00 AM11/9/15
to Trac Users
So, I've got it to execute the updated egg now. That results in 'NameError: global name 'to_unicode' is not defined'. Should I add an import?

F@lk

unread,
Nov 9, 2015, 8:31:56 AM11/9/15
to Trac Users
Yes, please, add:
    from trac.util.text import to_unicode
I haven't the development environment here currently, so I just think out loud.
CU, falkb

oneman

unread,
Nov 9, 2015, 8:54:13 AM11/9/15
to Trac Users
That solves the to_unicode issue, but then the old one is back again: 'UnicodeError: source returned bytes, but no encoding specified' on the same spot in roadmap.py...

What seems to happen is that the text is actually unicode, and in genshi/input.py the encoding is set to None:

if isinstance(text, unicode):
    # If it's unicode text the encoding should be set to None.
    # The option to pass in an incorrect encoding is for ease
    # of writing doctests that work in both Python 2.x and 3.x.
    return Stream(list(HTMLParser(StringIO(text), encoding=None)))

Somewhere along the line the unicode converted to another format because again in genshi/input.py it is checked and the error generated:

if not isinstance(data, unicode):
        raise UnicodeError("source returned bytes, but no encoding specified")

It seems to be a genshi issue...

As FjOllos suggested, I'll downgrade genshi to version 0.6 and see what happens. 

oneman

unread,
Nov 9, 2015, 10:27:13 AM11/9/15
to Trac Users
I downgraded genshi to version 0.6 and the roadmap page renders without errors. The only issue I see is that now the progress bars per milestone aren't properly rendered; they're simply a tiny vertical line.

F@lk

unread,
Nov 11, 2015, 2:58:42 AM11/11/15
to Trac Users
The error should be fixed now with trac-hacks revision 15049.
CU, F@lk

one...@onemanifest.net

unread,
Nov 11, 2015, 1:25:28 PM11/11/15
to trac-...@googlegroups.com
Works! Thanks. 

On 11 nov. 2015, at 08:58, F@lk <fbretts...@baumer.com> wrote:

The error should be fixed now with trac-hacks revision 15049.
CU, F@lk

--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/GOSrrAJPSOk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages