Merge branch 'ss/debug-folderfilter' into next

This commit is contained in:
Nicolas Sebrecht 2011-03-03 19:07:35 +01:00
commit c9ac254c8c
2 changed files with 5 additions and 1 deletions

View File

@ -23,6 +23,7 @@ from offlineimap.ui import getglobalui
class BaseRepository(CustomConfig.ConfigHelperMixin): class BaseRepository(CustomConfig.ConfigHelperMixin):
def __init__(self, reposname, account): def __init__(self, reposname, account):
self.ui = getglobalui()
self.account = account self.account = account
self.config = account.getconfig() self.config = account.getconfig()
self.name = reposname self.name = reposname
@ -144,7 +145,7 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
except (KeyboardInterrupt): except (KeyboardInterrupt):
raise raise
except: except:
getglobalui().warn("ERROR Attempting to create folder " \ self.ui.warn("ERROR Attempting to create folder " \
+ key + ":" +traceback.format_exc()) + key + ":" +traceback.format_exc())
# #

View File

@ -27,6 +27,7 @@ class IMAPRepository(BaseRepository):
def __init__(self, reposname, account): def __init__(self, reposname, account):
"""Initialize an IMAPRepository object.""" """Initialize an IMAPRepository object."""
BaseRepository.__init__(self, reposname, account) BaseRepository.__init__(self, reposname, account)
# self.ui is being set by the BaseRepository
self.imapserver = imapserver.ConfigedIMAPServer(self) self.imapserver = imapserver.ConfigedIMAPServer(self)
self.folders = None self.folders = None
self.nametrans = lambda foldername: foldername self.nametrans = lambda foldername: foldername
@ -250,6 +251,8 @@ class IMAPRepository(BaseRepository):
continue continue
foldername = imaputil.dequote(name) foldername = imaputil.dequote(name)
if not self.folderfilter(foldername): if not self.folderfilter(foldername):
self.ui.debug('imap',"Filtering out '%s' due to folderfilter" %\
foldername)
continue continue
retval.append(self.getfoldertype()(self.imapserver, foldername, retval.append(self.getfoldertype()(self.imapserver, foldername,
self.nametrans(foldername), self.nametrans(foldername),