Add Message.has_recipient() method.
				
					
				
			This commit is contained in:
		
							parent
							
								
									30a84767c9
								
							
						
					
					
						commit
						000b795fb0
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		|  | @ -74,6 +74,16 @@ class Message(Base): | ||||||
|         kwargs['recipient'] = user |         kwargs['recipient'] = user | ||||||
|         self.recipients.append(MessageRecipient(**kwargs)) |         self.recipients.append(MessageRecipient(**kwargs)) | ||||||
| 
 | 
 | ||||||
|  |     def has_recipient(self, user): | ||||||
|  |         """ | ||||||
|  |         Returns boolean indicating whether the given user is listed among the | ||||||
|  |         message's recipients. | ||||||
|  |         """ | ||||||
|  |         for recipient in self.recipients: | ||||||
|  |             if recipient.recipient is user: | ||||||
|  |                 return True | ||||||
|  |         return False | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| class MessageRecipient(Base): | class MessageRecipient(Base): | ||||||
|     """ |     """ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar