From 3c395c66a9bd926ebf3f10ea7d97eabd249c739a Mon Sep 17 00:00:00 2001 From: jgoerzen Date: Wed, 30 Oct 2002 05:26:49 +0100 Subject: [PATCH] /offlineimap/head: changeset 274 --- offlineimap/head/offlineimap/folder/IMAP.py | 11 ++++++++--- offlineimap/head/offlineimap/ui/Noninteractive.py | 7 +++++-- offlineimap/head/offlineimap/ui/Tk.py | 8 ++++++-- offlineimap/head/offlineimap/ui/UIBase.py | 7 +++++-- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/offlineimap/head/offlineimap/folder/IMAP.py b/offlineimap/head/offlineimap/folder/IMAP.py index 943a2a0..6a4ac0c 100644 --- a/offlineimap/head/offlineimap/folder/IMAP.py +++ b/offlineimap/head/offlineimap/folder/IMAP.py @@ -78,9 +78,14 @@ class IMAPFolder(BaseFolder): # Discard the message number. messagestr = string.split(messagestr, maxsplit = 1)[1] options = imaputil.flags2hash(messagestr) - uid = long(options['UID']) - flags = imaputil.flagsimap2maildir(options['FLAGS']) - self.messagelist[uid] = {'uid': uid, 'flags': flags} + if not options.has_key('UID'): + UIBase.getglobalui().warn('No UID in message with options %s' %\ + str(options), + minor = 1) + else: + uid = long(options['UID']) + flags = imaputil.flagsimap2maildir(options['FLAGS']) + self.messagelist[uid] = {'uid': uid, 'flags': flags} def getmessagelist(self): return self.messagelist diff --git a/offlineimap/head/offlineimap/ui/Noninteractive.py b/offlineimap/head/offlineimap/ui/Noninteractive.py index 42e5f9e..65b6937 100644 --- a/offlineimap/head/offlineimap/ui/Noninteractive.py +++ b/offlineimap/head/offlineimap/ui/Noninteractive.py @@ -26,8 +26,11 @@ class Basic(UIBase): def _msg(s, msg): print msg - def warn(s, msg): - sys.stderr.write("WARNING: " + str(msg) + "\n") + def warn(s, msg, minor = 0): + warntxt = 'WARNING' + if minor: + warntxt = 'warning' + sys.stderr.write(warntxt + ": " + str(msg) + "\n") def sleep(s, sleepsecs): if s.verbose >= 0: diff --git a/offlineimap/head/offlineimap/ui/Tk.py b/offlineimap/head/offlineimap/ui/Tk.py index a4b816b..85582b6 100644 --- a/offlineimap/head/offlineimap/ui/Tk.py +++ b/offlineimap/head/offlineimap/ui/Tk.py @@ -236,8 +236,12 @@ class VerboseUI(UIBase): s.top = None TextOKDialog("Main Program Exception", exceptionstr) - def warn(s, msg): - TextOKDialog("OfflineIMAP Warning", msg) + def warn(s, msg, minor): + if minor: + # Just let the default handler catch it + UIBase.warn(s, msg, minor) + else: + TextOKDialog("OfflineIMAP Warning", msg) def showlicense(s): TextOKDialog(version.productname + " License", diff --git a/offlineimap/head/offlineimap/ui/UIBase.py b/offlineimap/head/offlineimap/ui/UIBase.py index 43107f8..d9678c4 100644 --- a/offlineimap/head/offlineimap/ui/UIBase.py +++ b/offlineimap/head/offlineimap/ui/UIBase.py @@ -44,8 +44,11 @@ class UIBase: """Generic tool called when no other works.""" raise NotImplementedError - def warn(s, msg): - s._msg("WARNING: " + msg) + def warn(s, msg, minor = 0): + if minor: + s._msg("warning: " + msg) + else: + s._msg("WARNING: " + msg) def debug(s, debugtype, msg): thisthread = threading.currentThread()