[PATCH] Fix missing import and minor issue on folder selection
Sebastian at SSpaeth.de
Wed Jul 6 09:29:56 BST 2011
On Tue, 05 Jul 2011 23:24:59 +0200, Arnaud Fontaine <arnau at debian.org> wrote:
> I have attached to this email two small patches for the next branch.
> The first one just addresses a regression, whereas the second one
> addresses an AttributeError being raised when a folder has not been
> selected yet. I hope that's ok.
> BTW, thanks for offlineimap (I started using it since STARTTLS support
> was added and it has been working very well).
> Arnaud Fontaine
> From 63a4bfe3f984c26ea1fc5cf1cd0a2ad1a2fc3b7e Mon Sep 17 00:00:00 2001
> From: Arnaud Fontaine <arnau at debian.org>
> Date: Tue, 5 Jul 2011 21:01:35 +0200
> Subject: [PATCH 1/2] Add missing import of SSLError exception.
> In commit 89cbdc9, usage of SSLError was dropped but later reintroduced
> without importing SSLError exception.
> Signed-off-by: Arnaud Fontaine <arnau at debian.org>
> offlineimap/imapserver.py | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
> diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py
> index 0713eb8..a235fd5 100644
> --- a/offlineimap/imapserver.py
> +++ b/offlineimap/imapserver.py
> @@ -26,6 +26,11 @@ import socket
> import base64
> from socket import gaierror
> + from ssl import SSLError
> +except ImportError:
> + # Protect against python<2.6, use dummy and won't get SSL errors.
> + SSLError = None
+1 for reintroducing it, if it is still really missing. The revert and
remerging seems to have caused some confusion there, I am sorry.
As I had written this in the first place:
Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
> getselectedfolder() checks what is the current selected folder, but sometimes,
> selectedfolder attribute has not been set yet, thus an AttributeError
> exception is raised, whereas it would be harmless to return None here and
> later check with later call of select().
> - if self.getstate() == 'SELECTED':
> + if self.getstate() == 'SELECTED' and hasattr(self, "selectedfolder"):
This I am a bit more sceptical about. We should obviously be fixing
this, but this feels a bit more like we are papering over some design
the imaplib2 IMAP4 instance sets the mailbox name in "self.mailbox"
whenever it goes into SELECTED state, perhaps we should be using that
value rather than doing our own caching in the selectedfolder variable
This would avoid the kind of inconsistency that we are seeing in the
What do you think?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: not available
More information about the OfflineIMAP-project