From 50de2174bfbf35dfcc1b0f9253e46218fb29b986 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Sun, 8 Jan 2012 11:29:54 +0100 Subject: [PATCH] Allow to pass 'force' arg to selectro() to enforce a new select Pass through the 'force' argument from selectro() to select() so that it can also enforce a new SELECT even if we already are on that folder. Also change the default parameter from '0' to 'False' to make clear that this is a Bool. Signed-off-by: Sebastian Spaeth --- offlineimap/folder/IMAP.py | 8 ++++---- offlineimap/imaplibutil.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index 93f0c56..d23fb5f 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -42,19 +42,19 @@ class IMAPFolder(BaseFolder): self.randomgenerator = random.Random() #self.ui is set in BaseFolder - def selectro(self, imapobj): + def selectro(self, imapobj, force = False): """Select this folder when we do not need write access. Prefer SELECT to EXAMINE if we can, since some servers (Courier) do not stabilize UID validity until the folder is selected. .. todo: Still valid? Needs verification - + :param: Enforce new SELECT even if we are on that folder already. :returns: raises :exc:`OfflineImapError` severity FOLDER on error""" try: - imapobj.select(self.getfullname()) + imapobj.select(self.getfullname(), force = force) except imapobj.readonly: - imapobj.select(self.getfullname(), readonly = True) + imapobj.select(self.getfullname(), readonly = True, force = force) def suggeststhreads(self): return 1 diff --git a/offlineimap/imaplibutil.py b/offlineimap/imaplibutil.py index c9a7715..b4345fa 100644 --- a/offlineimap/imaplibutil.py +++ b/offlineimap/imaplibutil.py @@ -40,7 +40,7 @@ class UsefulIMAPMixIn(object): return self.mailbox return None - def select(self, mailbox='INBOX', readonly=False, force = 0): + def select(self, mailbox='INBOX', readonly=False, force = False): """Selects a mailbox on the IMAP server :returns: 'OK' on success, nothing if the folder was already