After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 360891 - simple-browser.py example doesn't work
simple-browser.py example doesn't work
Status: RESOLVED DUPLICATE of bug 321576
Product: gnome-python-extras
Classification: Deprecated
Component: gtkhtml2
2.14.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2006-10-09 12:36 UTC by Sebastien Bacher
Modified: 2006-10-09 13:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch attached by Jani Monoses to the Ubuntu bug (370 bytes, patch)
2006-10-09 12:37 UTC, Sebastien Bacher
none Details | Review

Description Sebastien Bacher 2006-10-09 12:36:42 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')
..."
Comment 1 Sebastien Bacher 2006-10-09 12:37:47 UTC
Created attachment 74351 [details] [review]
patch attached by Jani Monoses  to the Ubuntu bug
Comment 2 Gustavo Carneiro 2006-10-09 13:21:45 UTC

*** This bug has been marked as a duplicate of 321576 ***