[PATCH 2/4] accounts: nitpicking

Nicolas Sebrecht nicolas.s-dev at laposte.net
Wed Mar 25 04:42:28 GMT 2015


Signed-off-by: Nicolas Sebrecht <nicolas.s-dev at laposte.net>
---
 offlineimap/accounts.py | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py
index 19fff23..a7ad623 100644
--- a/offlineimap/accounts.py
+++ b/offlineimap/accounts.py
@@ -472,26 +472,26 @@ def syncfolder(account, remotefolder, quick):
 
         # Load remote folder.
         ui.loadmessagelist(remoterepos, remotefolder)
-        # Enforce maxage on remote folder by restricting to the lowest UID in
-        # the local messagelist (which has already been restricted using maxage)
-        if maxage:
-            # local messagelist might contain new messages (with uid's < 0)
-            positive_uids = filter(lambda uid: uid > 0,
-                localfolder.getmessageuidlist())
-            if positive_uids:
+        if maxage != None:
+            # local messagelist was applied maxage, already. Restrict sync for
+            # messages with UIDs >= min_uid from this list.
+            #
+            # local messagelist might contain new messages (with uid's < 0).
+            positive_uids = filter(
+                lambda uid: uid > 0, localfolder.getmessageuidlist())
+            if len(positive_uids) > 0:
                 remotefolder.cachemessagelist(min_uid=min(positive_uids))
-            else: # no messages with UID > 0 in range in localfolder
-                # maxage is calculated with respect to folder timezone, and
+            else:
+                # No messages with UID > 0 in range in localfolder.
+                # maxage was applied with respect to local dates but
                 # remote folder timezone might be different from local, so be
-                # safe and make sure the range isn't bigger than in local
+                # safe and make sure the range isn't bigger than in local.
                 remotefolder.cachemessagelist(maxage=maxage - 1)
         else:
             remotefolder.cachemessagelist()
         ui.messagelistloaded(remoterepos, remotefolder,
                              remotefolder.getmessagecount())
 
-
-
         # Synchronize remote changes.
         if not localrepos.getconfboolean('readonly', False):
             ui.syncingmessages(remoterepos, remotefolder, localrepos, localfolder)
-- 
2.3.1





More information about the OfflineIMAP-project mailing list