From 4da521eadcdc83b81d0fd6df2e82cfb79aa59279 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 10 Aug 2010 05:10:39 +0200 Subject: [PATCH] GuiImap: pass on auth failed error to GUI --- pyfpdb/GuiImapFetcher.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pyfpdb/GuiImapFetcher.py b/pyfpdb/GuiImapFetcher.py index 28f71399..9ed9bdba 100644 --- a/pyfpdb/GuiImapFetcher.py +++ b/pyfpdb/GuiImapFetcher.py @@ -19,6 +19,8 @@ import threading import pygtk pygtk.require('2.0') import gtk +from imaplib import IMAP4 + import ImapFetcher class GuiImapFetcher (threading.Thread): @@ -82,8 +84,15 @@ class GuiImapFetcher (threading.Thread): def importAllClicked(self, widget, data=None): self.statusLabel.set_label("Starting import. Please wait.") #FIXME: why doesnt this one show? for email in self.config.emails: - result=ImapFetcher.run(self.config.emails[email], self.db) - self.statusLabel.set_label("Finished import without error.") + try: + print "trying to run" + result=ImapFetcher.run(self.config.emails[email], self.db) + self.statusLabel.set_label("Finished import without error.") + print "finished to run" + except IMAP4.error as strerror: + if str(strerror)=="[AUTHENTICATIONFAILED] Authentication failed.": + self.statusLabel.set_label("Login to mailserver failed: please check mailserver, username and password") + #def importAllClicked def get_vbox(self):