[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH]Fix gtk.MessageDialog Exception



Hi,

When I tested the latest anaconda in my PC,I encountered
the following exception.

[exception]
--------
anaconda None exception report
Traceback (most recent call first):
  File "/usr/lib/anaconda/gui.py", line 788, in __init__
    self.dialog = gtk.MessageDialog(mainWindow, 0, style, buttons, text)
  File "/usr/lib/anaconda/gui.py", line 1067, in messageWindow
    custom_buttons, custom_icon, run=True, parent=parent).getrc()
  File "/usr/lib/anaconda/iw/autopart_type.py", line 213, in addZfcpDrive
    self.intf.messageWindow(_("Error"), e)
  File "/usr/lib/anaconda/iw/autopart_type.py", line 240, in addDrive
    rc = self.addZfcpDrive()
TypeError: GtkMessageDialog.__init__() argument 5 must be string or None, not exceptions.ValueError
--------

anaconda sometimes calls anaconda.intf.messageWindow with
exceptions.ValueError like this.
But gtk.MessageDialog in messageWindow can not accept it.

so I added str() to gtk.MessageDialog like the attached patch.
----------------------
self.dialog = gtk.MessageDialog(mainWindow, 0, style, buttons, str(text))
----------------------

or should I change all of calling side like the following?
----------------------
self.intf.messageWindow(_("Error"), str(e))
or
self.intf.messageWindow(_("Error"), "%s" %(e,))
----------------------

Would you review the attached patch and give me a comment,
please?

thanks,
Hiroshi HARA
diff --git a/gui.py b/gui.py
index 5f5c19f..024271c 100755
--- a/gui.py
+++ b/gui.py
@@ -794,7 +794,7 @@ class MessageWindow:
         elif custom_icon == "info":
             style = gtk.MESSAGE_INFO
 
-        self.dialog = gtk.MessageDialog(mainWindow, 0, style, buttons, text)
+        self.dialog = gtk.MessageDialog(mainWindow, 0, style, buttons, str(text))
 
         if parent:
             self.dialog.set_transient_for(parent)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]