1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-22 02:17:26 +00:00

utils.sort_domains wasn't right

This commit is contained in:
Joshua Tauberer 2014-07-09 12:35:12 +00:00
parent 1a74b81f44
commit deebda06e1

View File

@ -40,7 +40,7 @@ def sort_domains(domain_names, env):
# Within each group, sort parent domains before subdomains and after that sort lexicographically. # Within each group, sort parent domains before subdomains and after that sort lexicographically.
def sort_group(group): def sort_group(group):
# Find the top-most domains. # Find the top-most domains.
top_domains = sorted(d for d in group if len([s for s in group if s.startswith("." + d)]) == 0) top_domains = sorted(d for d in group if len([s for s in group if d.endswith("." + s)]) == 0)
ret = [] ret = []
for d in top_domains: for d in top_domains:
ret.append(d) ret.append(d)