summaryrefslogtreecommitdiff
path: root/Mailman/Utils.py
diff options
context:
space:
mode:
authorbwarsaw2001-10-15 21:40:56 +0000
committerbwarsaw2001-10-15 21:40:56 +0000
commitf11cf4d491cdf0364902d995988e6c514bf87732 (patch)
tree51420ad0969126eae78caadd3c7baa8f10736c75 /Mailman/Utils.py
parentdf280ac14b9ca4c84524e992889c4ad4472b5a26 (diff)
downloadmailman-f11cf4d491cdf0364902d995988e6c514bf87732.tar.gz
mailman-f11cf4d491cdf0364902d995988e6c514bf87732.tar.zst
mailman-f11cf4d491cdf0364902d995988e6c514bf87732.zip
List2Dict(): Add `foldcase' argument. When true, coerce all elements
in the dict to lowercase (yes they must be strings).
Diffstat (limited to 'Mailman/Utils.py')
-rw-r--r--Mailman/Utils.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py
index 2a2bfc41e..5ffdb99c7 100644
--- a/Mailman/Utils.py
+++ b/Mailman/Utils.py
@@ -275,13 +275,16 @@ def GetPossibleMatchingAddrs(name):
-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 List2Dict(list, foldcase=0):
+ """Return a dict keyed by the entries in the list passed to it."""
+ d = {}
+ if foldcase:
+ for i in list:
+ d[i.lower()] = 1
+ else:
+ for i in list:
+ d[i] = 1
+ return d
def FindMatchingAddresses(name, dict, *dicts):