From 6763f23a657417c675b40e5b66c823aa1e6cab50 Mon Sep 17 00:00:00 2001 From: mailman Date: Fri, 13 Mar 1998 18:23:21 +0000 Subject: 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!!) --- Mailman/Utils.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Mailman/Utils.py') diff --git a/Mailman/Utils.py b/Mailman/Utils.py index 80f7c55ea..ca6c6f429 100644 --- a/Mailman/Utils.py +++ b/Mailman/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 -- cgit v1.2.3-70-g09d2