diff options
| author | bwarsaw | 2000-09-12 19:09:26 +0000 |
|---|---|---|
| committer | bwarsaw | 2000-09-12 19:09:26 +0000 |
| commit | d6898ddea948499b945c4fb27e8ce43ac90e8335 (patch) | |
| tree | c374fbd4e0dcd544253daca7c4512e49b2c1161f /Mailman/Utils.py | |
| parent | 3e1ae52bd2838ec45824a41f79837325a29b5092 (diff) | |
| download | mailman-d6898ddea948499b945c4fb27e8ce43ac90e8335.tar.gz mailman-d6898ddea948499b945c4fb27e8ce43ac90e8335.tar.zst mailman-d6898ddea948499b945c4fb27e8ce43ac90e8335.zip | |
Diffstat (limited to 'Mailman/Utils.py')
| -rw-r--r-- | Mailman/Utils.py | 24 |
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, '[<>"&]') |
