summaryrefslogtreecommitdiff
path: root/src/mailman/database/autorespond.py
diff options
context:
space:
mode:
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):