63ce3f770d
This patch solves a problem about the comparison of mails used in foldersort. When foldersort is used, for example with: lambda x,y: -cmp(x,y) The user gets an error: ERROR: While attempting to sync account 'accountname' '<' not supported between instances of 'K' and 'K' Traceback: File "offlineimap3/offlineimap/accounts.py", line 298, in syncrunner self.__sync() File "offlineimap3/offlineimap/accounts.py", line 374, in __sync remoterepos.getfolders() File "offlineimap3/offlineimap/repository/IMAP.py", line 725, in getfolders retval.sort(key=cmp2key(self.foldersort)) The problem is because in Python 3, we must specify all parameters for total_ordering (see https://docs.python.org/3/library/functools.html in the functools.total_ordering block): Given a class defining one or more rich comparison ordering methods, this class decorator supplies the rest. This simplifies the effort involved in specifying all of the possible rich comparison operations: The class must define one of __lt__(), __le__(), __gt__(), or __ge__(). In addition, the class should supply an __eq__() method. Also, see: https://docs.python.org/3.1/library/stdtypes.html#comparisons Instances of a class cannot be ordered with respect to other instances of the same class, or other types of object, unless the class defines enough of the methods __lt__(), __le__(), __gt__(), and __ge__() (in general, __lt__() and __eq__() are sufficient, if you want the conventional meanings of the comparison operators). This patch implements all methods. Closes #33 |
||
---|---|---|
.. | ||
__init__.py | ||
Base.py | ||
Gmail.py | ||
GmailMaildir.py | ||
IMAP.py | ||
LocalStatus.py | ||
Maildir.py |