summaryrefslogtreecommitdiff
path: root/src/mailman/model/pending.py
diff options
context:
space:
mode:
authorBarry Warsaw2016-03-25 11:01:46 -0400
committerBarry Warsaw2016-03-25 11:01:46 -0400
commit7fd9e5ab09b0da347da0607b47d2d3838bd80f0c (patch)
treeb150f85e5fc482f45e973a233b5184d3ca4b78a7 /src/mailman/model/pending.py
parent71ebe367a52316811f570d09f2213c192a47973f (diff)
downloadmailman-7fd9e5ab09b0da347da0607b47d2d3838bd80f0c.tar.gz
mailman-7fd9e5ab09b0da347da0607b47d2d3838bd80f0c.tar.zst
mailman-7fd9e5ab09b0da347da0607b47d2d3838bd80f0c.zip
Diffstat (limited to 'src/mailman/model/pending.py')
-rw-r--r--src/mailman/model/pending.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/mailman/model/pending.py b/src/mailman/model/pending.py
index 6336ea14c..0e19f0cbf 100644
--- a/src/mailman/model/pending.py
+++ b/src/mailman/model/pending.py
@@ -17,15 +17,10 @@
"""Implementations of the IPendable and IPending interfaces."""
-__all__ = [
- 'Pended',
- 'Pendings',
- ]
-
-
import json
from lazr.config import as_timedelta
+from mailman import public
from mailman.config import config
from mailman.database.model import Model
from mailman.database.transaction import dbconnection
@@ -42,7 +37,7 @@ from zope.interface.verify import verifyObject
token_factory = TokenFactory()
-
+@public
@implementer(IPendedKeyValue)
class PendedKeyValue(Model):
"""A pended key/value pair, tied to a token."""
@@ -59,7 +54,7 @@ class PendedKeyValue(Model):
self.value = value
-
+@public
@implementer(IPended)
class Pended(Model):
"""A pended event, tied to a token."""
@@ -72,13 +67,13 @@ class Pended(Model):
key_values = relationship('PendedKeyValue', cascade="all, delete-orphan")
-
+@public
@implementer(IPendable)
class UnpendedPendable(dict):
PEND_TYPE = 'unpended'
-
+@public
@implementer(IPendings)
class Pendings:
"""Implementation of the IPending interface."""
@@ -113,8 +108,8 @@ class Pendings:
key = key.decode('utf-8')
if isinstance(value, bytes):
# Make sure we can turn this back into a bytes.
- value = dict(__encoding__='utf-8',
- value=value.decode('utf-8'))
+ value = dict(__encoding__='utf-8',
+ value=value.decode('utf-8'))
keyval = PendedKeyValue(key=key, value=json.dumps(value))
pending.key_values.append(keyval)
store.add(pending)
@@ -128,7 +123,7 @@ class Pendings:
if pendings.count() == 0:
return None
assert pendings.count() == 1, (
- 'Unexpected token count: {0}'.format(pendings.count()))
+ 'Unexpected token count: {}'.format(pendings.count()))
pending = pendings[0]
pendable = UnpendedPendable()
# Iterate on PendedKeyValue entries that are associated with the