typo with maxsize and maxage

Haojun Bao baohaojun at gmail.com
Fri Jun 24 15:23:37 BST 2011


Hi,

I found the maxsize setting unusable with Gmail, the backtrace:

    WARNING: ERROR in syncfolder for Gmail folder LetouWork: Traceback (most recent call last):
      File "/usr/lib/pymodules/python2.6/offlineimap/accounts.py", line 347, in syncfolder
        remotefolder.cachemessagelist()
      File "/usr/lib/pymodules/python2.6/offlineimap/folder/IMAP.py", line 160, in cachemessagelist
        searchresult = imapobj.search(None, search_condition)
      File "/usr/lib/pymodules/python2.6/offlineimap/imaplib2.py", line 904, in search
        return self._simple_command(name, *criteria, **kw)
      File "/usr/lib/pymodules/python2.6/offlineimap/imaplib2.py", line 1492, in _simple_command
        return self._command_complete(self._command(name, *args), kw)
      File "/usr/lib/pymodules/python2.6/offlineimap/imaplib2.py", line 1272, in _command_complete
        raise self.error('%s command error: %s %s. Data: %.100s' % (rqb.name, typ, dat, rqb.data))
    error: SEARCH command error: BAD ['Could not parse command']. Data: OCJN5 SEARCH ( SMALLER 500000)

See the extra space in "( SMALLER 500000)"? It's fixed by the following
patch:

commit ef32ac1a8c8966d2e2dcac8531b4cd3161952b5b
Author: baohaojun <baohaojun at gmail.com>
Date:   Fri Jun 24 22:10:40 2011 +0800

    maxsize/maxage: fix typo.
    
    Signed-off-by: Bao Haojun <baohaojun at gmail.com>
---
 offlineimap/folder/IMAP.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py
index 8851b5b..f636d7f 100644
--- a/offlineimap/folder/IMAP.py
+++ b/offlineimap/folder/IMAP.py
@@ -137,7 +137,7 @@ class IMAPFolder(BaseFolder):
                         search_condition += date_search_str
 
                     if(maxsize != -1):
-                        if(maxage != 1): #There are two conditions - add a space
+                        if(maxage != -1): #There are two conditions - add a space
                             search_condition += " "
 
                         search_condition += "SMALLER " + self.config.getdefault("Account " + self.accountname, "maxsize", -1)




More information about the OfflineIMAP-project mailing list