IMAPlib mixin class: pass 'readonly' exception to our callers

This will allow our callers who are capable of dealing with
readonly folders to properly detect this condition and act
accordingly.

One example is Gmail's "Chats" folder that is read-only,
but contains logs of the quick chats.

Tested-by: Abdó Roig-Maranges <abdo.roig@gmail.com>
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
This commit is contained in:
Eygene Ryabinkin 2012-08-05 22:40:52 +04:00
parent 010941e12e
commit 6c85a4518d

View File

@ -49,6 +49,9 @@ class UsefulIMAPMixIn(object):
del self.untagged_responses[:] del self.untagged_responses[:]
try: try:
result = super(UsefulIMAPMixIn, self).select(mailbox, readonly) result = super(UsefulIMAPMixIn, self).select(mailbox, readonly)
except self.readonly as e:
# pass self.readonly to our callers
raise
except self.abort as e: except self.abort as e:
# self.abort is raised when we are supposed to retry # self.abort is raised when we are supposed to retry
errstr = "Server '%s' closed connection, error on SELECT '%s'. Ser"\ errstr = "Server '%s' closed connection, error on SELECT '%s'. Ser"\