Hi there,

I've been working on libglade and libglade.GladeXML() in the stable
branch to get us to do proper error handling and exception raising
when the glade document is parsed.

This would, among other things, solve the problem with glade loading
a gnome file and having it explode because you didn't call
gnome.init() that was reported this month. It would raise an IOError
upon this condition (and upon other times where a None value was
returned).

I think this makes things nicer and more reasonable to Python; I can't
think of one example in Python where we see something like:

        >>> tree = libglade.GladeXML("foobar") # no exception
        >>> print tree
        None

What I have in my tree is is:

        >>> tree = libglade.GladeXML("foobar") # no exception
        ** WARNING **: glade-gnome tried to create a GnomeApp, but libgnome was
        not initialized

        ** WARNING **: failed to create a 'GnomeApp' widget
        Traceback (most recent call last):
          File "./killgnome.py", line 4, in ?
            libglade.GladeXML(sys.argv[1])
          File "/usr/lib/Stoq/lib/python2.1/site-packages/libglade.py", line 17,
        in __init__
            raise IOError, "failed to parse glade document (see previous warnings)"
        IOError: failed to parse glade document (see previous warnings)

I can't avoid the "(see previous warnings)" bit because of the way
libglade interacts with pygtk, but I still think this is the right thing
to do on the stable branch (since crashing is not good :)

Does anybody explicitly trust the tree to be None and do something
magical? 
    
I would very much like to fix this for 0.6.12, so If anybody would
like to comment on the approaches, they are GNOME bugs 97632 and
97633 (I still have another patch that does the right thing<tm> when
a parse error is found, but it's still unfiled).

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to