[PATCH 2/2] Enable debug output to see what folderfilter actually filters out

Sebastian Spaeth Sebastian at SSpaeth.de
Thu Mar 3 10:43:23 GMT 2011


It is currently very hard to find out what folderfilter actually does
and makes it hard to debug for a user. With this patch if the user has
enabled "-d imap" (even better would perhaps be a different debug type
for this kind of thing?), we see a message
"Filtering out folder 'foo' due to folderfilter"
in the logs.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
 offlineimap/repository/IMAP.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py
index 3bfa5db..76ff2c9 100644
--- a/offlineimap/repository/IMAP.py
+++ b/offlineimap/repository/IMAP.py
@@ -27,6 +27,7 @@ class IMAPRepository(BaseRepository):
     def __init__(self, reposname, account):
         """Initialize an IMAPRepository object."""
         BaseRepository.__init__(self, reposname, account)
+        # self.ui is being set by the BaseRepository
         self.imapserver = imapserver.ConfigedIMAPServer(self)
         self.folders = None
         self.nametrans = lambda foldername: foldername
@@ -250,6 +251,8 @@ class IMAPRepository(BaseRepository):
                 continue
             foldername = imaputil.dequote(name)
             if not self.folderfilter(foldername):
+                self.ui.debug('imap',"Filtering out '%s' due to folderfilter" %\
+                                  foldername)
                 continue
             retval.append(self.getfoldertype()(self.imapserver, foldername,
                                                self.nametrans(foldername),
-- 
1.7.1





More information about the OfflineIMAP-project mailing list