make sure, a domain is not used twice

This commit is contained in:
B. Petersen
2020-01-29 22:17:57 +01:00
parent 7be0bd3583
commit c883e709c3

View File

@@ -7,6 +7,7 @@ import yaml
out_all = ""
out_domains = ""
domains_dict = {}
def cleanstr(s):
@@ -43,9 +44,16 @@ def process_data(data, file):
domain = cleanstr(domain)
if domain == "" or domain.count(".") < 1 or domain.lower() != domain:
raise TypeError("bad domain: " + domain)
global domains_dict
if domains_dict.get(domain, False):
raise TypeError("domain used twice: " + domain)
domains_dict[domain] = True
domains += " (\"" + domain + "\", &*" + file2varname(file) + "),\n"
comment += domain + ", "
server = ""
has_imap = False
has_smtp = False