summaryrefslogtreecommitdiff
path: root/Mailman/Handlers/ToUsenet.py
Commit message (Collapse)AuthorAgeFilesLines
* Reorganize doctests, moving handler documentation into Mailman/handlers/docs.Barry Warsaw2008-01-241-49/+0
| | | | Rename all handlers to be more PEP 8 friendly, i.e. lowercased.
* Reorganize the qrunner infrastructure. First, the package has been renamedBarry Warsaw2007-09-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | from Mailman.Queue to Mailman.queue (note the case change to be more PEP 8 compliant). The Switchboard and Runner classes have been moved into the package __init__.py and the previous class modules have been removed. The switchboard cache is removed; I don't think it was ultimately buying us much. Now, just import the Switchboard class and instantiate it directly. Added an IRunner interface. Renamed the ArchRunner to ArchiveRunner. bin/qrunner and bin/mailmanctl are updated accordingly. For the former, it no long accepts -r=All to run all qrunners. You can still use the short name (e.g. --runner=incoming) to run the built-in queue runners, but this design will eventually allow for plugin qrunners by allowing them to be run specifying the full package path to the class. It also now accepts a leading dot to indicate a qrunner class relative to the Mailman.queue package.
* Update copyright years.bwarsaw2007-01-191-1/+1
|
* Fix some buglets with virtual domain support and repair unit tests broken bybwarsaw2006-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | this change. More unit tests should be added. misc/sitelist.cfg is removed -- this is an ex-site list. MailList.GetNoReplyEmail() -> MailList.no_reply_address (property) UserNotification._enqueue(), OwnerNotification._enqueue(): when queing the message to the virgin queue, be sure to use the fully qualified (i.e. posting) address for the list. In the MTA modules, be sure to set up the target of the mail commands as the fqdn listname because otherwise we can't find the correct list. This needs some tweaking/testing for Postfix's virtual domain support. MailList.Load() has to grow an optional argument specifying the fqdn listname. The problem is that in some situations, we can't calculate that because we don't know _internal_name, so it has to be passed in. This is mostly the case in the MailList ctor where a Load hasn't happened yet. For backward compatibility though, if it's not passed in, just use mlist.fqdn_listname.
* Fix test_message.py by finishing the wind-through of the configuration objectbwarsaw2006-07-081-2/+2
| | | | | | | | | | | | | | | | and fixing the invocation and shutdown of mailmanctl. While the tests in this module work individually, they do not yet work as a group. -C added to testall.py, and mailmanctl now passes that flag on to qrunner. UserNotification sets reduced_list_header in the msgdata, but the behavior of this flag has changed. It used to suppress List-Help, List-Subscribe, and List-Unsubscribe as well as List-Post and List-Archive. However, List-Help, List-Subscribe and List-Unsubscribe should definitely be included in UserNotifications, and List-Post has a different variable controlling it now. Therefore, always add List-Help, List-Subscribe, and List-Unsubscribe. Some style updates to Message.py
* - Convert all logging to Python's standard logging module. Get rid of allbwarsaw2006-04-171-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
|
* Allow postings gatewayed to Usenet to inhibit the Subject: fieldbwarsaw2002-07-311-1/+1
| | | | | | | | munging, separate from the mail list. This actually restores the original Subject: field which is stashed away in the metadata when it's munged in CookHeaders. Closes SF patch #573508. process(): We have to enqueue the message metadata too!
* Update copyright years.bwarsaw2002-03-161-1/+1
|
* Move COMMASPACE global from NewsRunner.py (where it isn't used) totwouters2001-07-101-0/+1
| | | | | | ToUsenet.py (where it is.) This is probably a glitch in the functionality split, anyway, and moving around the global saves on creation and destruction costs. Very important, that!
* Better syslog() calling conventions.bwarsaw2001-06-271-1/+1
|
* Conversion to mimelib.bwarsaw2001-02-151-82/+5
| | | | | | | | De-string-module-ify Other Python 2.0 constructs used where appropriate. Get rid of HandlerAPI references -- this module is obsolete.
* Rewritten to use the new multiple-queue model.bwarsaw2000-12-201-85/+32
| | | | | | | | process(): Makes a copy of the message, munges the copy's headers and requeues the copy to qfiles/news. This no longer does any forking, since handoff from Mailman->NNTPD is performed by the NewsRunner. do_child(): Get rid off.
* do_child(): Use a slightly different algorithm for munging thebwarsaw2000-09-221-5/+26
| | | | | | | | | | | Message-ID: header in posted messages. We define a machine parsable format containing the listname and the hostname, and if these match our list's name and hostname, we do not munge the header. This continues to allow crossposting to multiple gated mailing lists, but should break loops involving the nntpd in the most common case. Thanks to Jim Tittsler for pointing out the problem.
* do_child(): Unconditionally munge the Message-ID: header to somethingbwarsaw2000-09-191-3/+3
| | | | | | | | unique for each copy of the message posted to the news server. My news server at least will silently ignore multiple postings with the same Message-ID Assuming this analysis is correct, this closes SF bug #114164.
* process(): Be extra paranoid about the forks and child processes.bwarsaw2000-06-231-7/+11
| | | | | | | Make absolutely sure that the child process exits without returning control to the caller. If we complete successfully, we exit with status 0. If any exception occurs we print a traceback and exit with status 1.
* process(): Use the volatile `_kids' key to store the child pids.bwarsaw2000-06-201-2/+2
|
* do_child(): Use NNTP_USERNAME and NNTP_PASSWORD for optional site-widebwarsaw2000-06-051-1/+5
| | | | NNTP authentication values.
* Convert all uses of mlist.LogMsg() to the new syslog() interface.bwarsaw2000-06-021-6/+7
|
* Many changes to make message delivery more robust in the face ofbwarsaw2000-05-081-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* do_child(): Catch and cleanly report socket.error exceptions which canbwarsaw2000-04-071-5/+10
| | | | happen during the nntplib.NNTP() call.
* do_child(): Move subjpref outside the if subj: test, otherwise abwarsaw2000-04-041-1/+1
| | | | missing Subject: header will cause a NameError.
* do_child(): Move the global import of our own copy of nntplib intobwarsaw2000-03-231-7/+3
| | | | | this function, otherwise the "import nntplib" we forgot about whacks the one we wanted!
* do_child(): set reader mode when creating the NNTP connection.bwarsaw2000-03-211-1/+5
| | | | | | | Jim Tittsler writes: Posting also requires the server to be in 'mode reader' (at least our INN does). I think you only updated the cron/gatenews...
* Update the copyright lines to include the years 1999 & 2000.bwarsaw2000-03-211-1/+1
|
* Need to import sysbwarsaw2000-01-211-0/+1
|
* do_child(): catch and log nntplib.error_temp that can occur doing thebwarsaw1999-12-251-2/+9
| | | | conn.post() call.
* do_child(): contains all the code that the child processes perform.bwarsaw1999-12-101-76/+85
| | | | | Added a note about the children needing to be reaped, but that's a little difficult right now.
* Fix typos after testing, specifically:bwarsaw1999-11-121-6/+9
| | | | | | | | use getattr() not hasattr() For the outgoing message, take the object passed in as arg, flatten it via the str() method, and post the StringIO'd wrapper to the nntp process.
* New pipeline delivery modulebwarsaw1999-11-101-0/+116
"""Inject the message to Usenet."""