~barry/mailman/events-and-web

« back to all changes in this revision

Viewing changes to src/mailman/bin/checkdbs.py

  • Committer: Barry Warsaw
  • Date: 2012-01-30 15:37:16 UTC
  • Revision ID: barry@list.org-20120130153716-s9qx07i6i0rltyax
 * Held messages can now be moderated through the REST API.  Mailing list
   resources now accept a `held` path component.  GETing this returns all held
   messages for the mailing list.  POSTing to a specific request id under this
   url can dispose of the message using `Action` enums.
 * `IRequests` interface is removed.  Now just use adaptation from
   `IListRequests` directly (which takes an `IMailingList` object).
 * `handle_message()` now allows for `Action.hold` which is synonymous with
   `Action.defer` (since the message is already being held).
 * `IListRequests.get_request()` now takes an optional `request_type`
   argument to narrow the search for the given request.

- also, print_function is now a standard __future__ import.  The template has
  been updated, but add this to modules as you edit them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import optparse
21
21
 
22
22
from email.Charset import Charset
23
 
from zope.component import getUtility
24
23
 
25
24
from mailman import MailList
26
25
from mailman import Utils
29
28
from mailman.core.i18n import _
30
29
from mailman.email.message import UserNotification
31
30
from mailman.initialize import initialize
32
 
from mailman.interfaces.requests import IRequests
 
31
from mailman.interfaces.requests import IListRequests, RequestType
33
32
from mailman.version import MAILMAN_VERSION
34
33
 
35
34
# Work around known problems with some RedHat cron daemons
63
62
    lcset = mlist.preferred_language.charset
64
63
    pending = []
65
64
    first = True
66
 
    requestsdb = config.db.get_list_requests(mlist)
 
65
    requestsdb = IListRequests(mlist)
67
66
    for request in requestsdb.of_type(RequestType.subscription):
68
67
        if first:
69
68
            pending.append(_('Pending subscriptions:'))
128
127
    # Discard old held messages
129
128
    discard_count = 0
130
129
    expire = config.days(mlist.max_days_to_hold)
131
 
    requestsdb = config.db.get_list_requests(mlist)
 
130
    requestsdb = IListRequests(mlist)
132
131
    heldmsgs = list(requestsdb.of_type(RequestType.held_message))
133
132
    if expire and heldmsgs:
134
133
        for request in heldmsgs:
158
157
        # The list must be locked in order to open the requests database
159
158
        mlist = MailList.MailList(name)
160
159
        try:
161
 
            count = getUtility(IRequests).get_list_requests(mlist).count
 
160
            count = IListRequests(mlist).count
162
161
            # While we're at it, let's evict yesterday's autoresponse data
163
162
            midnight_today = midnight()
164
163
            evictions = []