mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Patch #1605192: list allowed states in error messages for imaplib.
This commit is contained in:
		
							parent
							
								
									9e6b47002a
								
							
						
					
					
						commit
						6c104f6906
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		|  | @ -746,8 +746,10 @@ def uid(self, command, *args): | |||
|         if not command in Commands: | ||||
|             raise self.error("Unknown IMAP4 UID command: %s" % command) | ||||
|         if self.state not in Commands[command]: | ||||
|             raise self.error('command %s illegal in state %s' | ||||
|                                     % (command, self.state)) | ||||
|             raise self.error("command %s illegal in state %s, " | ||||
|                              "only allowed in states %s" % | ||||
|                              (command, self.state, | ||||
|                               ', '.join(Commands[command]))) | ||||
|         name = 'UID' | ||||
|         typ, dat = self._simple_command(name, command, *args) | ||||
|         if command in ('SEARCH', 'SORT'): | ||||
|  | @ -811,8 +813,10 @@ def _command(self, name, *args): | |||
| 
 | ||||
|         if self.state not in Commands[name]: | ||||
|             self.literal = None | ||||
|             raise self.error( | ||||
|             'command %s illegal in state %s' % (name, self.state)) | ||||
|             raise self.error("command %s illegal in state %s, " | ||||
|                              "only allowed in states %s" % | ||||
|                              (name, self.state, | ||||
|                               ', '.join(Commands[name]))) | ||||
| 
 | ||||
|         for typ in ('OK', 'NO', 'BAD'): | ||||
|             if typ in self.untagged_responses: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Georg Brandl
						Georg Brandl