diff options
| author | mailman | 1998-03-13 18:23:21 +0000 |
|---|---|---|
| committer | mailman | 1998-03-13 18:23:21 +0000 |
| commit | 6763f23a657417c675b40e5b66c823aa1e6cab50 (patch) | |
| tree | 3bc1e1656b0e285d91b4ffe74b1e832d8143a471 /modules/mm_utils.py | |
| parent | f1407dfa1cd4f0b82e076094c944d3c3c6b57227 (diff) | |
| download | mailman-6763f23a657417c675b40e5b66c823aa1e6cab50.tar.gz mailman-6763f23a657417c675b40e5b66c823aa1e6cab50.tar.zst mailman-6763f23a657417c675b40e5b66c823aa1e6cab50.zip | |
Moved list_names() here from where i recently created it,
maillist.py.
Moved abstract description part of comment before ValidEmail in as a
docstring. (We need more and decent docstrings in this code!!)
Diffstat (limited to 'modules/mm_utils.py')
| -rw-r--r-- | modules/mm_utils.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/mm_utils.py b/modules/mm_utils.py index 80f7c55ea..ca6c6f429 100644 --- a/modules/mm_utils.py +++ b/modules/mm_utils.py @@ -27,9 +27,21 @@ valid_toplevels = ["com", "edu", "gov", "int", "mil", "net", "org", "uy", "uz", "vu", "va", "ve", "vn", "vg", "vi", "wf", "eh", "ws", "ye", "yu", "zr", "zm", "zw"] -# Make sure the email address passed isn't grossly invalid. -# Pretty minimal, cheesy check. We could do better... +def list_names(): + """Return the names of all lists in default list directory.""" + got = [] + for fn in os.listdir(mm_cfg.LIST_DATA_DIR): + if not ( + os.path.exists( + os.path.join(os.path.join(mm_cfg.LIST_DATA_DIR, fn), + 'config.db'))): + continue + got.append(fn) + return got + def ValidEmail(str): + """Verify that the an email address isn't grossly invalid.""" + # Pretty minimal, cheesy check. We could do better... if ((string.find(str, '|') <> -1) or (string.find(str, ';') <> -1) or str[0] == '-'): raise mm_err.MMHostileAddress |
