feat: rewrote get_description to allow extra text
Now if you want to add something to the end of the description, you can pass it via the addons parameter. Also moved a line that was duplicated to reduce the function length.
This commit is contained in:
		
					parent
					
						
							
								9a5c4616e3
							
						
					
				
			
			
				commit
				
					
						457e2c3315
					
				
			
		
					 1 changed files with 4 additions and 2 deletions
				
			
		|  | @ -53,7 +53,6 @@ def get_description(feed, length=250, min_length=150, addons=None): | |||
|                 break | ||||
|             else: | ||||
|                 length -= 1 | ||||
|         desc = temporary_string[:length] | ||||
|     except KeyError: | ||||
|         temporary_string = str(feed["description"]) | ||||
|         temporary_string = html_filter.sub("", temporary_string) | ||||
|  | @ -62,7 +61,10 @@ def get_description(feed, length=250, min_length=150, addons=None): | |||
|                 break | ||||
|             else: | ||||
|                 length -= 1 | ||||
|         desc = temporary_string[:length] | ||||
| 
 | ||||
|     desc = temporary_string[:length] | ||||
|     if addons is not None: | ||||
|         desc = desc + str(addons) | ||||
|     return desc | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue