diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-04-04 14:39:09 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-04-04 14:39:09 +0200 |
| commit | de12422fe0c52d11a9bec73aea2f92621302c6ae (patch) | |
| tree | 48d8605264162894b7d9957e2952be0d4d318730 /UpdateManager | |
| parent | 672afa8a5ebd29d89492cdb36a34cd791a3f4ada (diff) | |
| download | python-apt-de12422fe0c52d11a9bec73aea2f92621302c6ae.tar.gz | |
* added better error reporting for the DistUpgradeFetcher
Diffstat (limited to 'UpdateManager')
| -rw-r--r-- | UpdateManager/Common/utils.py | 12 | ||||
| -rw-r--r-- | UpdateManager/DistUpgradeFetcher.py | 23 |
2 files changed, 29 insertions, 6 deletions
diff --git a/UpdateManager/Common/utils.py b/UpdateManager/Common/utils.py index ffafadfb..17c62212 100644 --- a/UpdateManager/Common/utils.py +++ b/UpdateManager/Common/utils.py @@ -1,3 +1,4 @@ +import gtk def str_to_bool(str): if str == "0" or str.upper() == "FALSE": @@ -7,3 +8,14 @@ def str_to_bool(str): def utf8(str): return unicode(str, 'latin1').encode('utf-8') + +def error(parent, summary, message): + d = gtk.MessageDialog(parent=parent, + flags=gtk.DIALOG_MODAL, + type=gtk.MESSAGE_ERROR, + buttons=gtk.BUTTONS_CLOSE) + d.set_markup("<big><b>%s</b></big>\n\n%s" % (summary, message)) + d.set_title("") + res = d.run() + d.destroy() + return diff --git a/UpdateManager/DistUpgradeFetcher.py b/UpdateManager/DistUpgradeFetcher.py index 794566c2..bfc51f44 100644 --- a/UpdateManager/DistUpgradeFetcher.py +++ b/UpdateManager/DistUpgradeFetcher.py @@ -33,7 +33,7 @@ from gettext import gettext as _ import GtkProgress from ReleaseNotesViewer import ReleaseNotesViewer - +from Common.utils import * class DistUpgradeFetcher(object): @@ -196,22 +196,33 @@ class DistUpgradeFetcher(object): if not self.showReleaseNotes(): return if not self.fetchDistUpgrader(): - print "Fetch failed" + error("Failed to fetch", + "Fetching the upgrade failed. There may be a network " + "problem. ") return if not self.extractDistUpgrader(): - print "extract failed" + error("Failed to extract", + "Extracting the upgrade failed. There may be a problem " + "with the network or with the server. ") + return if not self.verifyDistUprader(): - print "verify failed" + error("Verfication failed", + "Verfing the upgrade failed. There may be a problem " + "with the network or with the server. ") self.cleanup() return if not self.authenticate(): - print "authenticate failed" + error("Authentication failed", + "Authenticating the upgrade failed. There may be a problem " + "with the network or with the server. ") self.cleanup() return self.runDistUpgrader() if __name__ == "__main__": - d = DistUpgradeFetcher(None) + error(None, "summary","message") + d = DistUpgradeFetcher(None,None) print d.authenticate('/tmp/Release','/tmp/Release.gpg') + |
