Python3 bugfixes

This commit is contained in:
2019-03-13 18:53:38 +01:00
parent b48f260979
commit 7368bab1b1

View File

@@ -112,8 +112,8 @@ class QuarantineMilter(Milter.Base):
for quarantine in self.config: for quarantine in self.config:
if len(self.recipients_quarantines) == len(self.recipients): if len(self.recipients_quarantines) == len(self.recipients):
# every recipient matched a quarantine already # every recipient matched a quarantine already
if min([q["index"] for q in self.recipients_quarantines.values()]) <= quarantine["index"]: if quarantine["index"] >= max([q["index"] for q in self.recipients_quarantines.values()]):
# every recipient matched a quarantine with at least the same precedence already, skip checks against quarantines with lower precedence # all recipients matched a quarantine with at least the same precedence already, skip checks against quarantines with lower precedence
self.logger.debug("{}: {}: skip further checks of this header".format(self.queueid, quarantine["name"])) self.logger.debug("{}: {}: skip further checks of this header".format(self.queueid, quarantine["name"]))
break break
@@ -280,7 +280,9 @@ def generate_milter_config(configtest=False, config_files=[]):
raise RuntimeError("option preferred_quarantine_action has illegal value") raise RuntimeError("option preferred_quarantine_action has illegal value")
# read active quarantine names # read active quarantine names
quarantine_names = list(set(map(str.strip, global_config["quarantines"].split(",")))) quarantine_names = [ q.strip() for q in global_config["quarantines"].split(",") ]
if len(quarantine_names) != len(set(quarantine_names)):
raise RuntimeError("at least one quarantine is specified multiple times in quarantines option")
if "global" in quarantine_names: if "global" in quarantine_names:
quarantine_names.remove("global") quarantine_names.remove("global")
logger.warning("removed illegal quarantine name 'global' from list of active quarantines") logger.warning("removed illegal quarantine name 'global' from list of active quarantines")