summaryrefslogtreecommitdiff
path: root/Mailman/Utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mailman/Utils.py')
-rw-r--r--Mailman/Utils.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py
index faa1d7b62..734f20cb4 100644
--- a/Mailman/Utils.py
+++ b/Mailman/Utils.py
@@ -367,6 +367,22 @@ def FindMatchingAddresses(name, dict, *dicts):
+_vowels = ('a', 'e', 'i', 'o', 'u')
+_consonants = ('b', 'c', 'd', 'f', 'g', 'h', 'k', 'm', 'n',
+ 'p', 'r', 's', 't', 'v', 'w', 'x', 'z')
+_syllables = []
+
+for v in _vowels:
+ for c in _consonants:
+ _syllables.append(c+v)
+ _syllables.append(v+c)
+
+def MakeRandomPassword(length=6):
+ syls = []
+ while len(syls)*2 < length:
+ syls.append(random.choice(_syllables))
+ return string.join(syls, '')[:length]
+
def GetRandomSeed():
chr1 = int(random.random() * 52)
chr2 = int(random.random() * 52)
@@ -379,14 +395,6 @@ def GetRandomSeed():
return "%c%c" % tuple(map(mkletter, (chr1, chr2)))
-def MakeRandomPassword(length=4):
- password = ""
- while len(password) < length:
- password = password + GetRandomSeed()
- password = password[:length]
- return password
-
-
def QuoteHyperChars(str):
arr = regsub.splitx(str, '[<>"&]')