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 <Sebastian@SSpaeth.de>
This commit is contained in:
parent
ed71805476
commit
50de2174bf
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user