summaryrefslogtreecommitdiff
path: root/src/mailman/database/autorespond.py
diff options
context:
space:
mode:
authorBarry Warsaw2009-02-19 00:18:35 -0500
committerBarry Warsaw2009-02-19 00:18:35 -0500
commitd0cb397ef31598e4fb6b7c70553ee9e9f23226ab (patch)
treee715c71eefc564fe8c93b0f9da031ca0d8aa3e56 /src/mailman/database/autorespond.py
parent165f53b5d38850589aa75122ab08c73c7ddcb127 (diff)
downloadmailman-d0cb397ef31598e4fb6b7c70553ee9e9f23226ab.tar.gz
mailman-d0cb397ef31598e4fb6b7c70553ee9e9f23226ab.tar.zst
mailman-d0cb397ef31598e4fb6b7c70553ee9e9f23226ab.zip
Diffstat (limited to 'src/mailman/database/autorespond.py')
-rw-r--r--src/mailman/database/autorespond.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mailman/database/autorespond.py b/src/mailman/database/autorespond.py
index 0a22dfa14..d65e8ed07 100644
--- a/src/mailman/database/autorespond.py
+++ b/src/mailman/database/autorespond.py
@@ -27,7 +27,7 @@ __all__ = [
]
-from storm.locals import And, Date, Int, Reference
+from storm.locals import And, Date, Desc, Int, Reference
from zope.interface import implements
from mailman.config import config
@@ -83,6 +83,16 @@ class AutoResponseSet:
self._mailing_list, address, response_type)
config.db.store.add(response)
+ def last_response(self, address, response_type):
+ """See `IAutoResponseSet`."""
+ results = config.db.store.find(
+ AutoResponseRecord,
+ And(AutoResponseRecord.address == address,
+ AutoResponseRecord.mailing_list == self._mailing_list,
+ AutoResponseRecord.response_type == response_type)
+ ).order_by(Desc(AutoResponseRecord.date_sent))
+ return (None if results.count() == 0 else results.first())
+
def adapt_mailing_list_to_response_set(iface, obj):