summaryrefslogtreecommitdiff
path: root/Mailman/Queue/CommandRunner.py
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright years.bwarsaw2007-01-191-1/+1
|
* Massive conversion process so that Mailman can be run from a user specifiedbwarsaw2006-07-081-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | configuration file. While the full conversion is not yet complete, everything that seems to be required to run mailmanctl, qrunner, rmlist, and newlist have been updated. Basically, modules should no longer import mm_cfg, but instead they should import Mailman.configuration.config. The latter is an object that's guaranteed to exist, but not guaranteed to be initialized until some top-level script calls config.load(). The latter should be called with the argument to -C/--config which is a new convention the above scripts have been given. In most cases, where mm_cfg.<variable> is used config.<variable> can be used, but the exceptions are where the default value must be available before config.load() is called. Sometimes you can import Mailman.Default and get the variable from there, but other times the code has to be changed to work around this limitation. Take each on a case-by-case basis. Note that the various directories calculated from VAR_PREFIX, EXEC_PREFIX, and PREFIX are now calculated in config.py, not in Defaults.py. This way a configuration file can override the base directories and everything should work correctly. Other changes here include: - mailmanctl, qrunner, and update are switched to optparse and $-strings, and changed to the mmshell architecture - An etc directory has been added to /usr/local/mailman and a mailman.cfg.sample file is installed there. Sites should now edit an etc/mailman.cfg file to do their configurations, although the mm_cfg file is still honored. The formats of the two files are identical. - list_lists is given the -C/--config option - Some coding style fixes in bin/update, but not extensive - Get rid of nested scope hacks in qrunner.py - A start on getting EmailBase tests working (specifically test_message), although not yet complete.
* Remove most uses of the types module, in favor of isinstance checks againstbwarsaw2006-04-171-3/+2
| | | | | | the builtin types. Two still remain: a check against ClassType and a check against MethodType. Also, fix some hinky type comparisons to use isinstance() consistently.
* - Convert all logging to Python's standard logging module. Get rid of allbwarsaw2006-04-171-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Now that Python 2.3 is the minimum requirement for Mailman 2.2:bwarsaw2006-04-151-21/+12
| | | | | | | | | | | - Remove True/False binding cruft - Remove __future__ statements for nested scopes - Remove ascii_letters import hack from Utils.py - Remove mimetypes.guess_all_extensions import hack from Scrubber.py - In Pending.py, set _missing to object() (better than using []) Also, update copyright years where appropriate, and re-order imports more to my PEP 8 tastes. Whitespace normalize.
* back porting from 2.1.6tkikuchi2005-08-281-8/+15
|
* FSF office has moved. chdcking in for MAIN branch.tkikuchi2005-08-271-1/+1
|
* True/False where appropriate.bwarsaw2003-04-061-7/+18
| | | | | Results.__init__(): Also do RFC 2047 decoding on Subject headers before processing.
* Update commentbwarsaw2003-03-311-2/+2
|
* Another instance of mixing unicode with 8-bit-dirty strings. Since emailtwouters2003-03-201-3/+9
| | | | | will assume it's 8-bit encoded to the passed-in character set, convert unicode objects to that encoding.
* When receiving an empty mail (no results and no unprocessed lines, buttwouters2003-03-111-0/+6
| | | | | | possibly 'ignored' lines, if a lot of 'em were blank) on a command-handler address, inform the user that the mail was empty, and how to get help. Based on SF patch #522080, Respond sensibly to blank -request email, by Seb Wills.
* do_command(): The __import__() can raise a ValueError too if the cmdbwarsaw2003-02-041-2/+3
| | | | has dots in it, so treat this the same as an ImportError.
* _dispose(): Actually (re-)implement the documented behavior for whenbwarsaw2002-12-021-0/+5
| | | | autorespond_requests == 1, which means answer and discard.
* Results.__init__(): Add a `respond' flag which is used bybwarsaw2002-11-211-1/+5
| | | | | | | | | send_response() to enable or suppress confirmation responses. For example, when confirming a subscription, if a welcome message is going to be sent out, we don't need to also send a results of the confirmation message. send_response(): Suppress the response if the `respond' flag is false.
* Results.__init__(): Give default argument of an empty string whenbwarsaw2002-11-081-1/+1
| | | | | | | pulling the Subject out of the command message. That's so later (e.g. in cmd_confirm.py) we won't try to .lower() a None. Closes SF bug report # 620032 by Ron Jarrell.
* send_response(): We have to pass the language into thebwarsaw2002-10-211-1/+2
| | | | UserNotification!
* make_response() -> send_response()bwarsaw2002-05-281-5/+15
| | | | | | send_response(): Check whether the sender has reached their autoresponse limit before sending the results of the command. This may not be the right time to do that check.
* _dispose(): Send the message through the Replybot handler so -requestbwarsaw2002-05-221-3/+6
| | | | emails will be autoresponded. Closes bug #558909.
* _dispose(): Inhibit replybot when Precedence: is any of bulk, junk, orbwarsaw2002-05-221-2/+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/+3
| | | | "bulk", we now include "junk" and "list" as well.
* _dispose(): Ignore messages that have "Precedence: bulk" but don'tbwarsaw2002-05-171-0/+9
| | | | have "X-Ack: yes".
* make_response(): In the list comprehension where we're calculating thebwarsaw2002-05-031-1/+1
| | | | | unprocessed lines, check for line == None (can happen if the message is sent to e.g. mylist-join with no body).
* Results.__init__(): Don't try to get the payload if there were nobwarsaw2002-05-031-0/+3
| | | | text/plain parts in the message.
* do_command(): If the Subject: header command was attempted and itbwarsaw2002-05-021-4/+12
| | | | | | failed, it might be because of a Re: prefix (or localized version thereof). Pop off the first component of the args, use that as the command and try again... once.
* Support the new email commands framework. We now no longer usebwarsaw2002-05-021-34/+115
| | | | | | | | | | | | | | MailCommandHandler.py. Specific changes include: class Results: Basically a bag to hold state during the processing of a particular email message loaded with commands. This makes it easy to pass data around (like the mailing list object and the message). It also contains the results of the command processing and gloms up the response email. _dispose(): This method actually gets simplified because it just needs to pass things to the Results instance and let it do the job of processing the email commands.
* _dispose(): Fil correctly pointed out that each of thebwarsaw2002-03-151-9/+17
| | | | | ParseMailCommands() calls in this runner need to be wrapped around a catch of TimeOutError.
* _dispose(): Wrap the ParseMailCommands() call in a try/except. If thebwarsaw2002-03-151-1/+6
| | | | | acquisition of the shared pending.db database lock fails, we want to requeue the message for another try later.
* _dispose(): Add support for the `toconfirm' key, used by the newbwarsaw2002-03-141-2/+12
| | | | confirm mail script.
* Constructor simplification. Since most derived classes are justbwarsaw2002-03-021-3/+1
| | | | | | | specializing the queue directory, make QDIR a class attribute and have Runner's ctor use that instead of an __init__() argument. This lets us get rid of most of the __init__()'s in the derived classes. (OutgoingRunner still needs one though.)
* This runner now only handles -request, -join, and -leave emails. Itbwarsaw2001-11-201-102/+10
| | | | | | | | | | | no longer handles any -admin or -owner messages, or any bounce processing. _dispose(): Don't look at the `authoritah' metadata key. Also, vastly simplify the main switch because it only needs to look at torequest, tojoin, and toleave. _toadmins(): Removed as unnecessary.
* _dispose(): Reorganize the big if/elif/else switch so that it neverbwarsaw2001-09-051-9/+7
| | | | | | just short-circuit returns. We need to do this after moving the Save() into the try clause (which may turn out to not be the right thing to do...)
* _dispose(): Factor out common code paths to _toadmins().bwarsaw2001-08-291-25/+36
| | | | | | | | | | | | | | | | _toadmins(): Run the message through SpamDetect to filter out known spam patterns in messages to the list owners/moderators. Log such detected spam to logs/spam and discard the message. Also, for every message to a list's -owner or -admin address, we always send it on to the list owners and moderators, even though the moderators can't access the admin pages (only the admindb pages). Note 1: this makes the `tomoderators' key in the message metadata obsolete. Note 2: this may not be the Right Thing To Do.
* Don't forget to import LockFile for its exception.twouters2001-07-101-0/+1
|
* Better syslog() calling conventions.bwarsaw2001-06-271-1/+1
|
* _dispose(): When a message is destined "toowner" and the metadatabwarsaw2001-05-311-1/+12
| | | | | contains the "tomoderators" key, sent the message to both the list owners and the list moderators.
* _dispose(): Add support for mylist-join and mylist-leave aliases. Thebwarsaw2001-05-111-0/+10
| | | | | | | | | | | | mail scripts simply add metadata `tojoin' or `toleave' respectively, which tell CommandRunner which operation to perform. This is a bit crufty since MailCommandHandler.ParseMailCommands() still handles the actual job of adding or deleting the member. CommandRunner hacks the Subject: line of the message to add just the specific desired command, and it empties the message's payload (effectively ignoring any additional commands or useless text in the email message).
* _dispose(): Have to pass ParseMailCommands() the msgdata dictionary.bwarsaw2001-03-031-1/+1
|
* _dispose(): If there's no appropriate key in the message metadata,bwarsaw2001-03-011-0/+12
| | | | | determine whether this message was destined for the -owner or -admin address and update the metadata.
* intermediatebwarsaw2001-02-281-1/+1
|
* CommandRunner which watches qfiles/commands for such things asbwarsaw2001-02-281-0/+123
bounces, confirm notices, and -request email commands.