mirror of
				https://github.com/mail-in-a-box/mailinabox.git
				synced 2025-10-30 18:50:53 +00:00 
			
		
		
		
	Fixed FURB118 (reimplemented-operator)
This commit is contained in:
		
							parent
							
								
									b1e094afe5
								
							
						
					
					
						commit
						9e33920db1
					
				| @ -14,6 +14,7 @@ import rtyaml | |||||||
| from exclusiveprocess import Lock | from exclusiveprocess import Lock | ||||||
| 
 | 
 | ||||||
| from utils import load_environment, shell, wait_for_service | from utils import load_environment, shell, wait_for_service | ||||||
|  | import operator | ||||||
| 
 | 
 | ||||||
| def backup_status(env): | def backup_status(env): | ||||||
| 	# If backups are disabled, return no status. | 	# If backups are disabled, return no status. | ||||||
| @ -91,7 +92,7 @@ def backup_status(env): | |||||||
| 
 | 
 | ||||||
| 	# Ensure the rows are sorted reverse chronologically. | 	# Ensure the rows are sorted reverse chronologically. | ||||||
| 	# This is relied on by should_force_full() and the next step. | 	# This is relied on by should_force_full() and the next step. | ||||||
| 	backups = sorted(backups.values(), key = lambda b : b["date"], reverse=True) | 	backups = sorted(backups.values(), key = operator.itemgetter("date"), reverse=True) | ||||||
| 
 | 
 | ||||||
| 	# Get the average size of incremental backups, the size of the | 	# Get the average size of incremental backups, the size of the | ||||||
| 	# most recent full backup, and the date of the most recent | 	# most recent full backup, and the date of the most recent | ||||||
|  | |||||||
| @ -13,6 +13,7 @@ import os, sqlite3, re | |||||||
| import utils | import utils | ||||||
| from email_validator import validate_email as validate_email_, EmailNotValidError | from email_validator import validate_email as validate_email_, EmailNotValidError | ||||||
| import idna | import idna | ||||||
|  | import operator | ||||||
| 
 | 
 | ||||||
| def validate_email(email, mode=None): | def validate_email(email, mode=None): | ||||||
| 	# Checks that an email address is syntactically valid. Returns True/False. | 	# Checks that an email address is syntactically valid. Returns True/False. | ||||||
| @ -239,7 +240,7 @@ def get_mail_aliases_ex(env): | |||||||
| 
 | 
 | ||||||
| 	# Sort aliases within each domain first by required-ness then lexicographically by address. | 	# Sort aliases within each domain first by required-ness then lexicographically by address. | ||||||
| 	for domain in domains: | 	for domain in domains: | ||||||
| 		domain["aliases"].sort(key = lambda alias : (alias["auto"], alias["address"])) | 		domain["aliases"].sort(key = operator.itemgetter("auto", "address")) | ||||||
| 	return domains | 	return domains | ||||||
| 
 | 
 | ||||||
| def get_domain(emailaddr, as_unicode=True): | def get_domain(emailaddr, as_unicode=True): | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user