diff options
| author | mailman | 1998-03-31 00:03:54 +0000 |
|---|---|---|
| committer | mailman | 1998-03-31 00:03:54 +0000 |
| commit | e5acc2df7dfa2490949bd805f23b2b70f0e15cf7 (patch) | |
| tree | 8cf277ccef56b08935ab22328287ef084909270d | |
| parent | 7fdadd108ec3b98d718e73eccddb36f860aafcf2 (diff) | |
| download | mailman-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-x | cgi/admin | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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" |
