mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	changed select() so readonly flag is treated as a boolean
This commit is contained in:
		
							parent
							
								
									a47d1c08d0
								
							
						
					
					
						commit
						14f39402af
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -155,7 +155,7 @@ def __init__(self, host = '', port = IMAP4_PORT):
 | 
				
			||||||
        self.tagged_commands = {}       # Tagged commands awaiting response
 | 
					        self.tagged_commands = {}       # Tagged commands awaiting response
 | 
				
			||||||
        self.untagged_responses = {}    # {typ: [data, ...], ...}
 | 
					        self.untagged_responses = {}    # {typ: [data, ...], ...}
 | 
				
			||||||
        self.continuation_response = '' # Last continuation response
 | 
					        self.continuation_response = '' # Last continuation response
 | 
				
			||||||
        self.is_readonly = None         # READ-ONLY desired state
 | 
					        self.is_readonly = False        # READ-ONLY desired state
 | 
				
			||||||
        self.tagnum = 0
 | 
					        self.tagnum = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Open socket to server.
 | 
					        # Open socket to server.
 | 
				
			||||||
| 
						 | 
					@ -622,12 +622,12 @@ def search(self, charset, *criteria):
 | 
				
			||||||
        return self._untagged_response(typ, dat, name)
 | 
					        return self._untagged_response(typ, dat, name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def select(self, mailbox='INBOX', readonly=None):
 | 
					    def select(self, mailbox='INBOX', readonly=False):
 | 
				
			||||||
        """Select a mailbox.
 | 
					        """Select a mailbox.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Flush all untagged responses.
 | 
					        Flush all untagged responses.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        (typ, [data]) = <instance>.select(mailbox='INBOX', readonly=None)
 | 
					        (typ, [data]) = <instance>.select(mailbox='INBOX', readonly=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        'data' is count of messages in mailbox ('EXISTS' response).
 | 
					        'data' is count of messages in mailbox ('EXISTS' response).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -636,7 +636,7 @@ def select(self, mailbox='INBOX', readonly=None):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        self.untagged_responses = {}    # Flush old responses.
 | 
					        self.untagged_responses = {}    # Flush old responses.
 | 
				
			||||||
        self.is_readonly = readonly
 | 
					        self.is_readonly = readonly
 | 
				
			||||||
        if readonly is not None:
 | 
					        if readonly:
 | 
				
			||||||
            name = 'EXAMINE'
 | 
					            name = 'EXAMINE'
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            name = 'SELECT'
 | 
					            name = 'SELECT'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue