summaryrefslogtreecommitdiff
path: root/Mailman/database/model
diff options
context:
space:
mode:
authorBarry Warsaw2007-09-09 13:22:27 -0400
committerBarry Warsaw2007-09-09 13:22:27 -0400
commitf1df4e6e79e7ba49ec0638fa4dd867b4043254f3 (patch)
tree7240ead35f058b7abf4caf2b34f3b32813c1b72d /Mailman/database/model
parent3fe9a220e8952853e51dbca359196d1f11dcbdc3 (diff)
downloadmailman-f1df4e6e79e7ba49ec0638fa4dd867b4043254f3.tar.gz
mailman-f1df4e6e79e7ba49ec0638fa4dd867b4043254f3.tar.zst
mailman-f1df4e6e79e7ba49ec0638fa4dd867b4043254f3.zip
ListAdmin mostly gone, but not quite.
Mailman/app/moderator.py: Most of the application level interface provided by ListAdmin is moved here now, including the ability to hold messages, subscriptions, and unsubscriptions, and to handle message (defer, discard, reject, accept). More work needed. Some untested conversion of API in Mailman/Cgi/admindb.py, confirm.py, bin/checkdbs.py. messagestore.py: Don't use or require the Date: header in the global message ID calculation. As described on the mailing list, we're only going to use the Message-ID header. IListRequests: added count_of() and of_type() methods.
Diffstat (limited to 'Mailman/database/model')
-rw-r--r--Mailman/database/model/requests.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/Mailman/database/model/requests.py b/Mailman/database/model/requests.py
index 59013452b..b0aa0d8d0 100644
--- a/Mailman/database/model/requests.py
+++ b/Mailman/database/model/requests.py
@@ -52,11 +52,22 @@ class ListRequests:
results = _Request.select_by(mailing_list=self.mailing_list._data)
return len(results)
+ def count_of(self, request_type):
+ results = _Request.select_by(mailing_list=self.mailing_list._data,
+ type=request_type)
+ return len(results)
+
@property
def held_requests(self):
results = _Request.select_by(mailing_list=self.mailing_list._data)
for request in results:
- yield request.id, request.type
+ yield request
+
+ def of_type(self, request_type):
+ results = _Request.select_by(mailing_list=self.mailing_list._data,
+ type=request_type)
+ for request in results:
+ yield request
def hold_request(self, request_type, key, data=None):
if request_type not in RequestType:
@@ -72,6 +83,15 @@ class ListRequests:
pendable.update(data)
token = config.db.pendings.add(pendable, timedelta(days=5000))
data_hash = token
+ # XXX This would be a good other way to do it, but it causes the
+ # select_by()'s in .count and .held_requests() to fail, even with
+ # flush()'s.
+## result = _Request.table.insert().execute(
+## key=key, type=request_type,
+## mailing_list=self.mailing_list._data,
+## data_hash=data_hash)
+## row_id = result.last_inserted_ids()[0]
+## return row_id
result = _Request(key=key, type=request_type,
mailing_list=self.mailing_list._data,
data_hash=data_hash)