summaryrefslogtreecommitdiff
path: root/Mailman/Handlers/Replybot.py
Commit message (Collapse)AuthorAgeFilesLines
* Reorganize doctests, moving handler documentation into Mailman/handlers/docs.Barry Warsaw2008-01-241-111/+0
| | | | Rename all handlers to be more PEP 8 friendly, i.e. lowercased.
* OMGW00T: After over a decade, the MailList mixin class is gone! Well,Barry Warsaw2007-09-211-3/+5
| | | | | | | | | | | | 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.
* Add doctest for Replybot handler. The test in test_handlers.py didn't reallybwarsaw2007-05-311-27/+14
| | | | | | | | | do anything. The doctest needs to have some way of testing the grace period, but it's still more tests of the module than there every was before. Update the Replyboty handler to use $-strings internally. Eliminate the use of %-strings in auto-response textsy. Only $-strings can be used, which allows us to get rid of another use of SafeDict.
* Update copyright years.bwarsaw2007-01-191-1/+1
|
* - Convert all logging to Python's standard logging module. Get rid of allbwarsaw2006-04-171-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | traces of our crufty old Syslog. Most of this work was purely mechanical, except for: 1) Initializing the loggers. For this, there's a new module Mailman/loginit.py (yes all modules from now on will use PEP 8 names). We can't call this 'logging.py' because that will interfere with importing the stdlib module of the same name (can you say Python 2.5 and absolute imports?). If you want to write log messages both to the log file and to stderr, pass True to loginit.initialize(). This will turn on propagation of log messages to the parent 'mailman' logger, which is set up to print to stderr. This is how bin/qrunner works when not running as a subprocess of mailmanctl. 2) The driver script. I had to untwist the StampedLogger stuff and implement differently printing exceptions and such to log/error because standard logging objects don't have a write() method. So we write to a cStringIO and then pass that to the logger. 3) SMTPDirect.py because of the configurability of the log messages. This required changing SafeDict into a dict subclass (which is better than using UserDicts anyway -- yay Python 2.3!). It's probably still possible to flummox things up if you change the name of the loggers in the SMTP_LOG_* variables in mm_cfg.py. However, the worst you can do is cause output to go to stderr and not go to a log file. Note too that all entry points into the Mailman system must call Mailman.loginit.initialize() or the log output will go to stderr (which may occasionally be what you want). Currently all CGIs and qrunners should be working properly. I wish I could have tested all code paths that touch the logger, but that's infeasible. I have tested this, but it's possible that there were some mistakes in the translation. - Mailman.Bouncers.BounceAPI.Stop is a singleton, but not a class instance any more. - True/False code cleanup, PEP 8 import restructuring, whitespace normalization, and copyright year updates, as appropriate.
* FSF office has moved. chdcking in for MAIN branch.tkikuchi2005-08-271-1/+1
|
* process(): Don't attempt to use the To field of the posted message inbwarsaw2003-03-211-3/+3
| | | | | | the Subject of the autoreply. This prevents funky characters in say the comment field of the To header from tripping up the reply message. Keep Thomas's Message.py fix as a fallback.
* process(): I don't think that logging the short circuit to logs/vettebwarsaw2002-10-151-9/+12
| | | | | is very useful, so remove this syslog call. Also, rewrite the comments, whitespace normalize, and pycheckerfy.
* process(): toadmin and the -admin address are deprecated.bwarsaw2002-05-221-4/+5
|
* process(): Inhibit replybot when Precedence: is any of bulk, junk, orbwarsaw2002-05-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | list. Chuq gives us the relevant info from the sendmail docs: When the name is found in a "Precedence:" field, the message class is set to num. Higher numbers mean higher precedence. Numbers less than zero have the special property that if an error occurs during pro- cessing the body of the message will not be returned; this is expected to be used for "bulk" mail such as through mailing lists. The default precedence is zero. For example, our list of precedences is: Pfirst-class=0 Pspecial-delivery=100 Plist=-30 Pbulk=-60 Pjunk=-100 People writing mailing list exploders are encouraged to use "Precedence: list". Older versions of sendmail (which discarded all error returns for negative prece- dences) didn't recognize this name, giving it a default precedence of zero. This allows list main- tainers to see error returns on both old and new ver- sions of sendmail.
* process(), _dispose(): Where we were testing Precedence: againstbwarsaw2002-05-191-2/+2
| | | | "bulk", we now include "junk" and "list" as well.
* process(): Don't replybot to messages that have "Precedence: bulk" butbwarsaw2002-05-171-1/+6
| | | | don't have "X-Ack: yes".
* GetAdminEmail() eradication campaign.bwarsaw2002-03-261-1/+1
| | | | | process(): Make the notification email appear to come from the -bounces address.
* GetAdminEmail() eradication campaign.bwarsaw2002-03-261-1/+1
| | | | | | | process(), hold_for_approval(), do_discard(): Make the notification email appear to come from the -bounces address. When the sender is for human consumption, make it the -owner address (or in the case of Cleanse.py for anonymous lists, the list posting address).
* process(): When the mailing list object has a true attributebwarsaw2002-02-231-0/+3
| | | | | | | | use_dollar_strings, this means the list has been converted from the traditional (and error prone) %-substitution strings to the new experimental $-substitution strings. We need to internally convert the $-strings back into (safe) %-strings to utilize Python's string mod operator.
* process(), hold_for_approval(), do_discard(): When creating thebwarsaw2002-02-111-2/+2
| | | | | | | | UserNotification message object, pass in the language that the message should be in. This allows us to get the character set and header encodings right. Patch by Ben Gertzfield.
* process(): Be much more careful about bogus source strings for thebwarsaw2001-07-131-13/+14
| | | | | | | | | | | | | | dictionary interpolation. Since they're coming from the great unwashed masses, the autoresponse texts could have bogus %()s bits in them, and using a SafeDict doesn't guard against all kinds of exceptions. So, if any exception is caught during interpolation, log it, and use the raw autoresponse text in the email. Also, because we're not using the buggy rfc822.py module anymore, we don't need to special case the situation when the first line of the autoresponse text has a colon in it.
* Mark some more strings as translatable.bwarsaw2001-03-021-4/+6
|
* Conversion to mimelib.bwarsaw2001-02-151-10/+10
| | | | | | | | De-string-module-ify Other Python 2.0 constructs used where appropriate. Get rid of HandlerAPI references -- this module is obsolete.
* process(): Get rid of the string module in favor of string methods.bwarsaw2000-12-201-5/+6
|
* Removed debugging cruft.bwarsaw2000-09-181-1/+0
|
* process(): Do not send autoreplies to messages that have 'noack' setbwarsaw2000-09-181-1/+2
| | | | in their msgdata. Closes bug #114603.
* process(): Local patch for SF bug# 109220; if the autoresponse textbwarsaw2000-08-021-1/+10
| | | | | has a colon in the first line, prepend a blank line so that rfc822.Message doesn't get confused about headers vs. body.
* process(): Be sure to wrap() the autoresponse text, since it's goingbwarsaw2000-07-241-1/+1
| | | | out as email.
* process(): Treat the -admin and -owner addresses as equivalent forbwarsaw2000-07-221-3/+5
| | | | autoresponse purposes.
* Many changes to make message delivery more robust in the face ofbwarsaw2000-05-081-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | failures, bugs, and lock acquisition timeouts. Instead of storing information about the progress of the delivery on the Message object, we pass around a parallel data structure called `msgdata' (current just a dictionary). All calculated information is passed through this object, but this changes the API to handler modules. They now take three arguments: the mailing list, the message object, and the msgdata. WARNING: This may change before 2.0 final. Specific changes include: HandlerAPI DiscardMessage(), HandlerAPI.SomeRecipientsFailed(): New shared exceptions. pipeline_deliver(): removed LIST_PIPELINE: global containing the primary list delivery pipeline DelivertoList: Revamped main entry point into message delivery to list membership. Takes three arguments: the mailing list, the message object, and the msgdata dictionary. This digs the pipeline to use out of the msgdata (allowing resumption of prematurely interrupted pipeline deliveries). Then each module is called in turn, and the shared exceptions are caught. As each module is completed successfully, it is removed from the head of the pipeline. This function returns the number of pipeline modules remaining to be executed (i.e. a return of 0 means DeliverToList() is done with this message and it can be dequeued). A catch-all is included in case some unexpected exception occurs (say a bug or typo in one of the delivery modules). Such an error will queue the message, so at least it doesn't just get lost. We try to never just lose a message. RedeliverMessage(), DeliverToUser(): reimplemented in terms of DeliverToList(). Acknowledge, AfterDelivery, CalcRecips, Cleanse, CookHeaders, Decorate, Replybot, ToArchive, ToUsenet Fix the function signature to match the new API (three arguments), and changed the implementations to extract delivery information from msgdata instead of as attributes of the message object. Approved Same as above, but also removed NotApproved exception. LoopError is now multiply derived from HandlerAPI.DiscardMessage and Errors.MMLoopingPost. Hold Same as above, but also changed slightly the way an exception is raised when a message is held. hold_for_approval() now takes four arguments (the msgdata parameter has been added), and the exc object can be a class or instance. If it's a class, it is simply zero-arg'd instantiated. We also use the str() of the exception to get us the reason for the hold. This allows us to override HandlerAPI.MessageHeld.__str__() for MessageToBig so that we can include the size of the message being held. SMTPDirect Same as above, but instead of explicitly enqueuing the messages when some or all of the recipient deliveries failed, just raise a HandlerAPI.SomeRecipientsFailed exception and let DeliverToList() manage the enqueuing. Thus queue_message() is removed. Sendmail Same as above, but if any chunks fail delivery, those recipients are queued by raising SomeRecipientsFailed. SpamDetect Same as above, except that if a regexp matches, a SpamDetect exception is raised directly. The DeliverToList() framework discards these spam messages instead of holding them for approval. ToDigest Same as above, except that if a digest is prepared for delivery, it is not sent directly via mlist.Post(). Instead, the message is queued for delivery, thereby relinquishing the lock soon. This means that digests will only be sent the next time qrunner runs.
* Update the copyright lines to include the years 1999 & 2000.bwarsaw2000-03-211-1/+1
|
* process(): had the shutcut return logic slightly offbwarsaw2000-02-261-1/+1
|
* process(): Added support for autoresponding to the -request address.bwarsaw2000-02-261-5/+14
| | | | | | | | Works very much like the other autoresponders. This module does /not/ handle differentiating between -request "reply and discard" and "reply and forward". Also, slightly rephrased the autoresponse subject: header.
* The handler module which actually does the auto-responding. A fewbwarsaw2000-02-191-0/+82
notes: If the message contains an "X-Ack: No" header, then it is never auto-responded to. This, in fact, is used to break both internal recursion and potential mail loops. If the message contains an "X-Ack: Yes" header, then it is auto-responded to even if the grace period hasn't expired (but the grace period is updated).