[PATCH 2/2] mailbox IMAP4 instance attribute is set to the current selected folder.

Sebastian Spaeth Sebastian at SSpaeth.de
Thu Jul 7 09:47:26 BST 2011


On Wed,  6 Jul 2011 23:08:08 +0200, Arnaud Fontaine wrote:
> selectedfolder instance attribute  is only set if a  folder was selected, thus

> rely on mailbox attribute instead.
>      def getselectedfolder(self):
> -        if self.getstate() == 'SELECTED':
> -            return self.selectedfolder
> -        return None
> +        return self.mailbox

For this, *I* prefer the patch I sent previously, as we still should check
for self.state=='SELECTED' before returning anything. I see in imaplib2
that we often change states without resetting self.mailbox to None, so
we should be sure here that self.state really is right before we claim
that any mailbox is selected.

Also my patch removes the setting of the now unneeded cache variable
self.selectedfolder. Arnaud identified the issue however, and Nicolas
might want to modify my commit message to credit Arnaud for this. I have
never experienced this error and I don't know in which cases it can
occur, but evidently it did.

Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110707/8166a442/attachment-0001.sig>


More information about the OfflineIMAP-project mailing list