summaryrefslogtreecommitdiff
path: root/Mailman/Cgi/admindb.py
diff options
context:
space:
mode:
authorbwarsaw2001-05-03 21:18:25 +0000
committerbwarsaw2001-05-03 21:18:25 +0000
commitcb15f13431e8433eda8b25b178e3b48b1b02de36 (patch)
treead5556763a14f515353d594030f7128615f7ff4f /Mailman/Cgi/admindb.py
parent1e27b487e019791459ff03c5b4b92d7e9f7dd917 (diff)
downloadmailman-cb15f13431e8433eda8b25b178e3b48b1b02de36.tar.gz
mailman-cb15f13431e8433eda8b25b178e3b48b1b02de36.tar.zst
mailman-cb15f13431e8433eda8b25b178e3b48b1b02de36.zip
Diffstat (limited to 'Mailman/Cgi/admindb.py')
-rw-r--r--Mailman/Cgi/admindb.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/Mailman/Cgi/admindb.py b/Mailman/Cgi/admindb.py
index cc061be26..72680ed9e 100644
--- a/Mailman/Cgi/admindb.py
+++ b/Mailman/Cgi/admindb.py
@@ -16,6 +16,7 @@
"""Produce and process the pending-approval items for a list."""
+import sys
import os
import types
import cgi
@@ -75,18 +76,27 @@ def main():
doc = Document()
doc.set_language(mlist.preferred_language)
- # Lock the list for the next operation. BAW: Strictly speaking, the list
- # should not need to be locked just to read the request database. However
- # the request database asserts that the list is locked in order to load
- # it and it's not worth complicating that logic.
+ # We need a signal handler to catch the SIGTERM that can come from Apache
+ # when the user hits the browser's STOP button. See the comment in
+ # admin.py for details.
#
- # Also, see the comment in admin.py about the need for the signal handler.
+ # BAW: Strictly speaking, the list should not need to be locked just to
+ # read the request database. However the request database asserts that
+ # the list is locked in order to load it and it's not worth complicating
+ # that logic.
def sigterm_handler(signum, frame, mlist=mlist):
+ # Make sure the list gets unlocked...
mlist.Unlock()
+ # ...and ensure we exit, otherwise race conditions could cause us to
+ # enter MailList.Save() while we're in the unlocked state, and that
+ # could be bad!
+ sys.exit(0)
mlist.Lock()
try:
+ # Install the emergency shutdown signal handler
signal.signal(signal.SIGTERM, sigterm_handler)
+
realname = mlist.real_name
if not cgidata.keys():
# If this is not a form submission (i.e. there are no keys in the