summaryrefslogtreecommitdiff
path: root/Mailman/Pending.py
diff options
context:
space:
mode:
authorbwarsaw2001-07-19 00:07:47 +0000
committerbwarsaw2001-07-19 00:07:47 +0000
commit2ac14c37f45861dd5fd52747f86e36404068a2df (patch)
treeb6f0ea4592445ed04f6da7b33c79f5fb2f5f7f47 /Mailman/Pending.py
parent350c7035af89ed08673a3d8e167ac8ee4e1033c4 (diff)
downloadmailman-2ac14c37f45861dd5fd52747f86e36404068a2df.tar.gz
mailman-2ac14c37f45861dd5fd52747f86e36404068a2df.tar.zst
mailman-2ac14c37f45861dd5fd52747f86e36404068a2df.zip
Diffstat (limited to 'Mailman/Pending.py')
-rw-r--r--Mailman/Pending.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/Mailman/Pending.py b/Mailman/Pending.py
index f196fd505..7182ec492 100644
--- a/Mailman/Pending.py
+++ b/Mailman/Pending.py
@@ -76,9 +76,14 @@ def new(*content):
-def confirm(cookie):
- """Return data for cookie, removing it from db, or None if not found."""
+def confirm(cookie, expunge=1):
+ """Return data for cookie, or None if not found.
+
+ If optional expunge is true (the default), the record is also removed from
+ the database.
+ """
# Acquire the pending database lock, letting TimeOutError percolate up.
+ # BAW: we perhaps shouldn't acquire the lock if expunge==0.
lock = LockFile.LockFile(LOCKFILE)
lock.lock(timeout=30)
try:
@@ -89,8 +94,9 @@ def confirm(cookie):
if content is missing:
return None
# Remove the entry from the database
- del db[cookie]
- _save(db)
+ if expunge:
+ del db[cookie]
+ _save(db)
return content
finally:
lock.unlock()