GuiImap: pass on auth failed error to GUI

This commit is contained in:
steffen123 2010-08-10 05:10:39 +02:00
parent d94254c9cd
commit 4da521eadc

View File

@ -19,6 +19,8 @@ import threading
import pygtk import pygtk
pygtk.require('2.0') pygtk.require('2.0')
import gtk import gtk
from imaplib import IMAP4
import ImapFetcher import ImapFetcher
class GuiImapFetcher (threading.Thread): class GuiImapFetcher (threading.Thread):
@ -82,8 +84,15 @@ class GuiImapFetcher (threading.Thread):
def importAllClicked(self, widget, data=None): def importAllClicked(self, widget, data=None):
self.statusLabel.set_label("Starting import. Please wait.") #FIXME: why doesnt this one show? self.statusLabel.set_label("Starting import. Please wait.") #FIXME: why doesnt this one show?
for email in self.config.emails: for email in self.config.emails:
result=ImapFetcher.run(self.config.emails[email], self.db) try:
self.statusLabel.set_label("Finished import without error.") 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 importAllClicked
def get_vbox(self): def get_vbox(self):