diff options
| -rw-r--r-- | Mailman/MailList.py | 14 | ||||
| -rw-r--r-- | Mailman/Utils.py | 8 |
2 files changed, 16 insertions, 6 deletions
diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 68d57a807..5116b9e3a 100644 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -141,8 +141,8 @@ class MailList(MailCommandHandler, HTMLFormatter, Deliverer, ListAdmin, def FindUser(self, email): matches = Utils.FindMatchingAddresses(email, - (self.members, - self.digest_members)) + self.members, + self.digest_members) if not matches or not len(matches): return None return matches[0] @@ -944,8 +944,8 @@ class MailList(MailCommandHandler, HTMLFormatter, Deliverer, ListAdmin, Errors.LOOPING_POST, msg.getheader('subject')) if len(self.forbidden_posters): - addrs = Utils.FindMatchingAddresses(sender, - self.forbidden_posters) + forbidden_posters = Utils.List2Dict(self.forbidden_posters) + addrs = Utils.FindMatchingAddresses(sender, forbidden_posters) if len(addrs): self.AddRequest('post', Utils.SnarfMessage(msg), Errors.FORBIDDEN_SENDER_MSG, @@ -955,7 +955,8 @@ class MailList(MailCommandHandler, HTMLFormatter, Deliverer, ListAdmin, Errors.MODERATED_LIST_MSG, msg.getheader('subject')) elif self.moderated and len(self.posters): - addrs = Utils.FindMatchingAddresses(sender, self.posters) + addrs = Utils.FindMatchingAddresses(sender, + Utils.List2Dict(self.posters)) if not len(addrs): self.AddRequest('post', Utils.SnarfMessage(msg), Errors.MODERATED_LIST_MSG, @@ -964,7 +965,8 @@ class MailList(MailCommandHandler, HTMLFormatter, Deliverer, ListAdmin, # not moderated # elif len(self.posters): - addrs = Utils.FindMatchingAddresses(sender, self.posters) + addrs = Utils.FindMatchingAddresses(sender, + Utils.List2Dict(self.posters)) if not len(addrs): if self.member_posting_only: if not self.IsMember(sender): diff --git a/Mailman/Utils.py b/Mailman/Utils.py index 8dc110f2e..4e358d927 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -338,6 +338,14 @@ def GetPossibleMatchingAddrs(name): return res +def List2Dict(list): + """List2Dict returns a dict keyed by the entries in the list + passed to it.""" + res = {} + for item in list: + res[item] = 1 + return res + def FindMatchingAddresses(name, dict, *dicts): """Given an email address, and any number of dictionaries keyed by |
