summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormailman1998-03-31 00:03:54 +0000
committermailman1998-03-31 00:03:54 +0000
commite5acc2df7dfa2490949bd805f23b2b70f0e15cf7 (patch)
tree8cf277ccef56b08935ab22328287ef084909270d
parent7fdadd108ec3b98d718e73eccddb36f860aafcf2 (diff)
downloadmailman-e5acc2df7dfa2490949bd805f23b2b70f0e15cf7.tar.gz
mailman-e5acc2df7dfa2490949bd805f23b2b70f0e15cf7.tar.zst
mailman-e5acc2df7dfa2490949bd805f23b2b70f0e15cf7.zip
Abstract out error_page and error_page_doc, as in roster script - in
preparation to moving them somewhere like mm_utils, where we can change the error-notice format centrally...
-rwxr-xr-xcgi/admin15
1 files changed, 13 insertions, 2 deletions
diff --git a/cgi/admin b/cgi/admin
index 4a79ff7d1..e22d67e8e 100755
--- a/cgi/admin
+++ b/cgi/admin
@@ -396,6 +396,18 @@ def ChangeOptions(list, opt_list, cgi_info, document):
list.Save()
+def error_page(errmsg, *args):
+ print apply(error_page_doc, (errmsg,) + args).Format()
+
+def error_page_doc(errmsg, *args):
+ """Produce a simple error-message page on stdout and exit.
+
+ Optional arg justreturn means just return the doc, don't print it."""
+ doc = htmlformat.Document()
+ doc.AddItem(htmlformat.Header(2, "Error"))
+ doc.AddItem(htmlformat.Bold(errmsg % args))
+ return doc
+
if __name__ == "__main__":
try:
main()
@@ -403,8 +415,7 @@ if __name__ == "__main__":
print "Interrupted!"
raise SystemExit, 0
except mm_err.MMUnknownListError, msg:
- doc.AddItem(htmlformat.Header(2, "%s: %s" % (list_name, msg)))
- print doc.Format()
+ error_page("%s: %s", list_name, msg)
raise SystemExit, 0
except:
print "Content-type: text/html\n"