summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2001-10-21 06:33:44 +0000
committerbwarsaw2001-10-21 06:33:44 +0000
commit930a5c737caf023ef20e3fbcaca764dfc0ae58ad (patch)
treeee5780b550961f7efdd026abef83b810e1812693
parent39ee0e54a8e433def508d650afdcec1376b32529 (diff)
downloadmailman-930a5c737caf023ef20e3fbcaca764dfc0ae58ad.tar.gz
mailman-930a5c737caf023ef20e3fbcaca764dfc0ae58ad.tar.zst
mailman-930a5c737caf023ef20e3fbcaca764dfc0ae58ad.zip
new(): Slight code cleanup; _ALLKEYS holds a list of 1-tuples of all
the valid Pending types. (They're 1-tuples so that the assert is more robust).
-rw-r--r--Mailman/Pending.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Mailman/Pending.py b/Mailman/Pending.py
index bbd7bf0ef..7d45f215b 100644
--- a/Mailman/Pending.py
+++ b/Mailman/Pending.py
@@ -41,17 +41,17 @@ UNSUBSCRIPTION = 'U'
CHANGE_OF_ADDRESS = 'C'
HELD_MESSAGE = 'H'
+_ALLKEYS = [(x,) for x in (SUBSCRIPTION, UNSUBSCRIPTION,
+ CHANGE_OF_ADDRESS, HELD_MESSAGE,
+ )]
+
def new(*content):
"""Create a new entry in the pending database, returning cookie for it."""
# It's a programming error if this assertion fails! We do it this way so
# the assert test won't fail if the sequence is empty.
- assert content[:1] in ((SUBSCRIPTION,),
- (UNSUBSCRIPTION,),
- (CHANGE_OF_ADDRESS,),
- (HELD_MESSAGE,),
- )
+ assert content[:1] in _ALLKEYS
# Acquire the pending database lock, letting TimeOutError percolate up.
lock = LockFile.LockFile(LOCKFILE)
lock.lock(timeout=30)