docker-offlineimap/offlineimap
Rodolfo García Peñas (kix) 63ce3f770d foldersort broken with instance comparison
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
2020-12-30 21:49:19 +01:00
..
folder Avoid crash in search if no results 2020-11-08 22:07:14 +01:00
repository foldersort broken with instance comparison 2020-12-30 21:49:19 +01:00
ui ui/UIBase.py do not use builtin object as variable 2020-08-30 18:12:17 +02:00
utils distro_utils.py renamed variable f 2020-11-01 08:31:47 +01:00
__init__.py Reformat offlineimap/__init__.py 2020-08-29 20:04:40 +02:00
accounts.py accounts: decode output of hooks 2020-10-12 09:01:59 +02:00
CustomConfig.py six: changed offlineimap/CustomConfig.py 2020-09-03 21:35:54 +02:00
emailutil.py emailutil.py updated docstrings 2020-08-30 18:21:00 +02:00
error.py Reformat offlineimap/error.py 2020-08-29 20:15:55 +02:00
globals.py Reformat offlineimap/globals.py 2020-08-29 20:16:35 +02:00
imaplibutil.py BUG: offlineimap3 fails with tunneled connections 2020-12-28 18:54:53 +01:00
imapserver.py Added Debug for imaplib2 2020-11-08 21:30:22 +01:00
imaputil.py Allow folder names with atom specials 2020-10-11 23:01:08 +02:00
init.py removed virtual_imaplib2 2020-08-31 16:24:26 +02:00
localeval.py localeval.py removed extra parenthesys 2020-08-30 18:52:56 +02:00
mbnames.py mbnames.py removed extra parenthesys 2020-08-30 18:53:02 +02:00
threadutil.py Removed doxygen param 2020-10-10 14:50:47 +02:00