GNOME Bugzilla – Bug 360891
simple-browser.py example doesn't work
Last modified: 2006-10-09 13:21:45 UTC
That bug has been opened on https://launchpad.net/distros/ubuntu/+source/gnome-python-extras/+bug/63804 "Binary package hint: python-gnome2-extras The example /usr/share/doc/python-gnome2-extras/examples/gtkhtml2/simple-browser.py doesn't work properly. Running it, with python /usr/share/doc/python-gnome2-extras/examples/gtkhtml2/simple-browser.py, shows the initial example page (with "Hello world!" and a link to the Gnome site saying "click me") correctly. Clicking the link, however, makes it disappear, and it does not show the site as expected. It writes the following on the terminal: link_clicked: http://www.gnome.org/ /usr/share/doc/python-gnome2-extras/examples/gtkhtml2/simple-browser.py:45: Warning: invalid uninstantiatable type `(null)' in cast to `GObject' document.close_stream() /usr/share/doc/python-gnome2-extras/examples/gtkhtml2/simple-browser.py:45: Warning: g_object_unref: assertion `G_IS_OBJECT (object)' failed document.close_stream() ** (simple-browser.py:7542): CRITICAL **: dom_Document__get_documentElement: assertion `doc != NULL' failed ... The problem seems to be that gtkhtml2.Document.open_stream() doesn't handle a Content-type with a charset specified. http://www.gnome.org/ has a Content-type of "text/html; charset=utf-8". The following hack resolves the problem, but it should be done better: --- /usr/share/doc/python-gnome2-extras/examples/gtkhtml2/simple-browser.py 2002-04-30 02:02:20.000000000 +0100 +++ simple-browser.py 2006-10-03 18:41:07.000000000 +0100 @@ -38,6 +38,7 @@ headers = f.info() mime = headers.getheader('Content-type') if mime: + if mime.find(';') != -1: mime = mime.split(';')[0] document.open_stream(mime) else: document.open_stream('text/plain') ..."
Created attachment 74351 [details] [review] patch attached by Jani Monoses to the Ubuntu bug
*** This bug has been marked as a duplicate of 321576 ***