[PATCH] Fix missing import and minor issue on folder selection

Arnaud Fontaine arnau at debian.org
Wed Jul 6 10:01:26 BST 2011


>> 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
> deficiency.
> 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
> there. This would  avoid the kind of inconsistency  that we are seeing
> in the first place.

That's a good  point indeed. I have  attached a patch to do  that, but I
think  that getselectedfolder should  perhaps be  moved to  IMAP4 class,
isn't it?

Arnaud Fontaine

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mailbox-IMAP4-instance-attribute-is-set-to-the-curre.patch
Type: text/x-diff
Size: 1080 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110706/26317a71/attachment-0003.patch>
-------------- 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/20110706/26317a71/attachment-0001.sig>

More information about the OfflineIMAP-project mailing list