From e6e708ec786bbdb3b94a8d4ef7bd10559ee2fd2c Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Sun, 5 Feb 2012 13:17:16 +0100 Subject: [PATCH] Don't use sort() on dict values() This won't work in python3 anymore, so just use sorted() when needed. In one case, we could remove the sort() completely as were were sanity checking one line above, that we only having one UID as response which makes sorting unneeded. Signed-off-by: Sebastian Spaeth --- offlineimap/folder/IMAP.py | 3 +-- offlineimap/imaputil.py | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index 4e7e885..0bbe746 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -1,5 +1,5 @@ # IMAP folder support -# Copyright (C) 2002-2011 John Goerzen & contributors +# Copyright (C) 2002-2012 John Goerzen & contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -327,7 +327,6 @@ class IMAPFolder(BaseFolder): raise ValueError("While attempting to find UID for message with " "header %s, got wrong-sized matchinguids of %s" %\ (headername, str(matchinguids))) - matchinguids.sort() return long(matchinguids[0]) def savemessage_fetchheaders(self, imapobj, headername, headervalue): diff --git a/offlineimap/imaputil.py b/offlineimap/imaputil.py index ba1f458..7165e09 100644 --- a/offlineimap/imaputil.py +++ b/offlineimap/imaputil.py @@ -182,13 +182,12 @@ def flagsimap2maildir(flagstring): return retval def flagsmaildir2imap(maildirflaglist): - """Convert set of flags ([DR]) into a string '(\\Draft \\Deleted)'""" + """Convert set of flags ([DR]) into a string '(\\Deleted \\Draft)'""" retval = [] for imapflag, maildirflag in flagmap: if maildirflag in maildirflaglist: retval.append(imapflag) - retval.sort() - return '(' + ' '.join(retval) + ')' + return '(' + ' '.join(sorted(retval)) + ')' def uid_sequence(uidlist): """Collapse UID lists into shorter sequence sets