<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span><br></span></div><div><span>Sebastian wrote:<br></span></div>>> getselectedfolder() checks what is the current selected folder, but sometimes,<br><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;">>> selectedfolder attribute has not been set yet, thus an AttributeError<br>>> exception is raised, whereas it would be harmless to return None here and<br>>> later check with later call of select().<br>>> - if self.getstate() == 'SELECTED':<br>>> + if self.getstate() == 'SELECTED' and hasattr(self, "selectedfolder"):<br>><br>>This I am a bit more sceptical about. We should obviously be fixing<br>>this, but this
feels a bit more like we are papering over some design<br>>deficiency.<br>><br>>the imaplib2 IMAP4 instance sets the mailbox name in "self.mailbox"<br>>whenever it goes into SELECTED state, perhaps we should be using that<br>>value rather than doing our own caching in the selectedfolder variable<br>>there.<br>>This would avoid the kind of inconsistency that we are seeing in the<br>>first place.<br>><br>>What do you think?<br><br>@Sebastian:<br><br>+1. Must maintain "cache coherency," (as they say in the world of CPU's)... and avoid caching data beyond the point in time where it likely could become stale/incorrect.<br><br>Chris<br></div></div></div></body></html>