diff options
| author | Barry Warsaw | 2007-09-21 08:51:38 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2007-09-21 08:51:38 -0400 |
| commit | 65c64773d910b3b2a3e2a9b9db4669e57170ece2 (patch) | |
| tree | 1bb742b2dc5898e569e19d8967e8d51a5d5c0352 /Mailman/Handlers | |
| parent | 892316be3c09eec4a1f8117bfd9eb44bba1c9117 (diff) | |
| download | mailman-65c64773d910b3b2a3e2a9b9db4669e57170ece2.tar.gz mailman-65c64773d910b3b2a3e2a9b9db4669e57170ece2.tar.zst mailman-65c64773d910b3b2a3e2a9b9db4669e57170ece2.zip | |
OMGW00T: After over a decade, the MailList mixin class is gone! Well,
mostly. It's no longer needed by anything in the test suite, and
therefore the list manager returns database MailingList objects
directly. The wrapper cruft has been removed.
To accomplish this, a couple of hacks were added to the Mailman.app
package, which will get cleaned up over time. The MailList module
itself (and its few remaining mixins) aren't yet removed from the tree
because some of the code is still not tested, and I want to leave this
code around until I've finished converting it.
Diffstat (limited to 'Mailman/Handlers')
| -rw-r--r-- | Mailman/Handlers/CookHeaders.py | 3 | ||||
| -rw-r--r-- | Mailman/Handlers/Hold.py | 17 | ||||
| -rw-r--r-- | Mailman/Handlers/Replybot.py | 8 | ||||
| -rw-r--r-- | Mailman/Handlers/Scrubber.py | 6 | ||||
| -rw-r--r-- | Mailman/Handlers/ToDigest.py | 2 |
5 files changed, 22 insertions, 14 deletions
diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py index 5634fa23e..82c87c20b 100644 --- a/Mailman/Handlers/CookHeaders.py +++ b/Mailman/Handlers/CookHeaders.py @@ -26,6 +26,7 @@ from email.Utils import parseaddr, formataddr, getaddresses from Mailman import Utils from Mailman import Version +from Mailman.app.archiving import get_base_archive_url from Mailman.configuration import config from Mailman.constants import ReplyToMunging from Mailman.i18n import _ @@ -207,7 +208,7 @@ def process(mlist, msg, msgdata): headers['List-Post'] = '<mailto:%s>' % mlist.posting_address # Add this header if we're archiving if mlist.archive: - archiveurl = mlist.GetBaseArchiveURL() + archiveurl = get_base_archive_url(mlist) if archiveurl.endswith('/'): archiveurl = archiveurl[:-1] headers['List-Archive'] = '<%s>' % archiveurl diff --git a/Mailman/Handlers/Hold.py b/Mailman/Handlers/Hold.py index 75f7b6386..2e6eeb4ad 100644 --- a/Mailman/Handlers/Hold.py +++ b/Mailman/Handlers/Hold.py @@ -43,7 +43,10 @@ from Mailman import Errors from Mailman import Message from Mailman import Utils from Mailman import i18n +from Mailman.app.bounces import ( + has_explicit_destination, has_matching_bounce_header) from Mailman.app.moderator import hold_message +from Mailman.app.replybot import autorespond_to_sender from Mailman.configuration import config from Mailman.interfaces import IPendable @@ -88,7 +91,7 @@ class Administrivia(Errors.HoldMessage): reason = _('Message may contain administrivia') def rejection_notice(self, mlist): - listurl = mlist.GetScriptURL('listinfo', absolute=1) + listurl = mlist.script_url('listinfo') request = mlist.request_address return _("""Please do *not* post administrative requests to the mailing list. If you wish to subscribe, visit $listurl or send a message with the @@ -171,7 +174,7 @@ def process(mlist, msg, msgdata): # Implicit destination? Note that message originating from the Usenet # side of the world should never be checked for implicit destination. if mlist.require_explicit_destination and \ - not mlist.HasExplicitDest(msg) and \ + not has_explicit_destination(mlist, msg) and \ not msgdata.get('fromusenet'): # then hold_for_approval(mlist, msg, msgdata, ImplicitDestination) @@ -179,7 +182,7 @@ def process(mlist, msg, msgdata): # # Suspicious headers? if mlist.bounce_matching_headers: - triggered = mlist.hasMatchingHeader(msg) + triggered = has_matching_bounce_header(mlist, msg) if triggered: # TBD: Darn - can't include the matching line for the admin # message because the info would also go to the sender @@ -239,7 +242,7 @@ def hold_for_approval(mlist, msg, msgdata, exc): 'reason' : _(reason), 'sender' : sender, 'subject' : usersubject, - 'admindb_url': mlist.GetScriptURL('admindb', absolute=1), + 'admindb_url': mlist.script_url('admindb'), } # We may want to send a notification to the original sender too fromusenet = msgdata.get('fromusenet') @@ -259,10 +262,10 @@ def hold_for_approval(mlist, msg, msgdata, exc): member = mlist.members.get_member(sender) lang = (member.preferred_language if member else mlist.preferred_language) if not fromusenet and ackp(msg) and mlist.respond_to_post_requests and \ - mlist.autorespondToSender(sender, lang): + autorespond_to_sender(mlist, sender, lang): # Get a confirmation token - d['confirmurl'] = '%s/%s' % (mlist.GetScriptURL('confirm', absolute=1), - token) + d['confirmurl'] = '%s/%s' % ( + mlist.script_url('confirm'), token) lang = msgdata.get('lang', lang) subject = _('Your message to $listname awaits moderator approval') text = Utils.maketext('postheld.txt', d, lang=lang, mlist=mlist) diff --git a/Mailman/Handlers/Replybot.py b/Mailman/Handlers/Replybot.py index 18fc83ced..7017d9dd5 100644 --- a/Mailman/Handlers/Replybot.py +++ b/Mailman/Handlers/Replybot.py @@ -19,6 +19,7 @@ import time import logging +import datetime from string import Template @@ -29,6 +30,7 @@ from Mailman.i18n import _ log = logging.getLogger('mailman.error') __i18n_templates__ = True +NODELTA = datetime.timedelta() @@ -63,7 +65,7 @@ def process(mlist, msg, msgdata): sender = msg.get_sender() now = time.time() graceperiod = mlist.autoresponse_graceperiod - if graceperiod > 0 and ack <> 'yes': + if graceperiod > NODELTA and ack <> 'yes': if toadmin: quiet_until = mlist.admin_responses.get(sender, 0) elif torequest: @@ -79,7 +81,7 @@ def process(mlist, msg, msgdata): 'Auto-response for your message to the "$realname" mailing list') # Do string interpolation into the autoresponse text d = dict(listname = realname, - listurl = mlist.GetScriptURL('listinfo'), + listurl = mlist.script_url('listinfo'), requestemail = mlist.request_address, owneremail = mlist.owner_address, ) @@ -98,7 +100,7 @@ def process(mlist, msg, msgdata): outmsg['X-Ack'] = 'No' outmsg.send(mlist) # update the grace period database - if graceperiod > 0: + if graceperiod > NODELTA: # graceperiod is in days, we need # of seconds quiet_until = now + graceperiod * 24 * 60 * 60 if toadmin: diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py index a70cb0c71..655742899 100644 --- a/Mailman/Handlers/Scrubber.py +++ b/Mailman/Handlers/Scrubber.py @@ -38,6 +38,7 @@ from Mailman import LockFile from Mailman import Message from Mailman import Utils from Mailman.Errors import DiscardMessage +from Mailman.app.archiving import get_base_archive_url from Mailman.configuration import config from Mailman.i18n import _ @@ -388,7 +389,8 @@ def makedirs(dir): def save_attachment(mlist, msg, dir, filter_html=True): - fsdir = os.path.join(mlist.archive_dir(), dir) + fsdir = os.path.join(config.PRIVATE_ARCHIVE_FILE_DIR, + mlist.fqdn_listname, dir) makedirs(fsdir) # Figure out the attachment type and get the decoded data decodedpayload = msg.get_payload(decode=True) @@ -496,7 +498,7 @@ def save_attachment(mlist, msg, dir, filter_html=True): fp.write(decodedpayload) fp.close() # Now calculate the url - baseurl = mlist.GetBaseArchiveURL() + baseurl = get_base_archive_url(mlist) # Private archives will likely have a trailing slash. Normalize. if baseurl[-1] <> '/': baseurl += '/' diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py index 5fd08852f..7e2dcc6d2 100644 --- a/Mailman/Handlers/ToDigest.py +++ b/Mailman/Handlers/ToDigest.py @@ -179,7 +179,7 @@ def send_i18n_digests(mlist, mboxfp): 'masthead.txt', {'real_name' : mlist.real_name, 'got_list_email': mlist.posting_address, - 'got_listinfo_url': mlist.GetScriptURL('listinfo', absolute=1), + 'got_listinfo_url': mlist.script_url('listinfo'), 'got_request_email': mlist.request_address, 'got_owner_email': mlist.owner_address, }, mlist=mlist) |
