[ python-Bugs-1277098 ] imaplib Imap.select() uses comparison to 'None' for boolean

SourceForge.net noreply at sourceforge.net
Wed Aug 31 12:32:34 CEST 2005


Bugs item #1277098, was opened at 2005-08-31 15:52
Message generated for change (Comment added) made by pierslauder
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1277098&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Stephen Thorne (jerub)
Assigned to: Piers Lauder (pierslauder)
Summary: imaplib Imap.select() uses comparison to 'None' for boolean

Initial Comment:
The imap class's method for selecting a mailbox in read
only mode is subtly broken. Calling i.select('INBOX',
readonly=0) will cause the imap library to open the
mailbox in EXAMINE mode, not SELECT.

     def select(self, mailbox='INBOX', readonly=None):
         if readonly is not None:
             name = 'EXAMINE'
         else:
             name = 'SELECT'

So passing what seems to be a boolean option into the
function causes unexpected circumstances in client code.

Recommend that the comparison be changed to 'if readonly:'.

I have verified this code exists in python2.3 and in
python cvs head.

----------------------------------------------------------------------

>Comment By: Piers Lauder (pierslauder)
Date: 2005-08-31 20:32

Message:
Logged In: YES 
user_id=196212

The manual suggests that "set"ing the 'readonly' flag will
disable modifications, and I agree the suggested change
would produce the expected behaviour - will check in a fix...


----------------------------------------------------------------------

Comment By: Stephen Thorne (jerub)
Date: 2005-08-31 15:54

Message:
Logged In: YES 
user_id=100823

assigned to pierslauder as per abaxter's request.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1277098&group_id=5470


More information about the Python-bugs-list mailing list