summaryrefslogtreecommitdiff
path: root/Mailman/Queue/NewsRunner.py
Commit message (Collapse)AuthorAgeFilesLines
* Reorganize the qrunner infrastructure. First, the package has been renamedBarry Warsaw2007-09-291-164/+0
| | | | | | | | | | | | | | | | | | | | | | 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.
* Repair some test suite regressions.Barry Warsaw2007-08-011-1/+1
|
* Move the pending database into the SQLAlchemy/Elixir layer. The oldBarry Warsaw2007-08-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pending.py module is removed. Added an interface to this functionality such that any IPendable (essentially a key/value mapping) can be associated with a token, and that token can be confirmed and has a lifetime. Any keys and values can be stored, as long as both are unicodes. Added a doctest. Modified initialization of the database layer to support pluggability via setuptools. No longer is this layer initialized from a module, but now it's instantiated from a class that implements IDatabase. The StockDatabase class implements the SQLAchemy/Elixir layer, but this can be overridden in a setup.py. Bye bye MANAGERS_INIT_FUNCTION, we hardly knew ye. Added a package Mailman.app which will contain certain application specific functionality. Right now, the only there there is an IRegistar implementation, which didn't seem to fit anywhere else. Speaking of which, the IRegistrar interface implements all the logic related to registration and verification of email addresses. Think the equivalent of MailList.AddMember() except generalized out of a mailing list context. This latter will eventually go away. The IRegistrar sends the confirmation email. Added an IDomain interface, though the only implementation of this so far lives in the registration.txt doctest. This defines the context necessary for domain-level things, like address confirmation. A bunch of other cleanups in modules that are necessary due to the refactoring of Pending, but don't affect anything that's actually tested yet, so I won't vouch for them (except that they don't throw errors on import!). Clean up Defaults.py; also turn the functions seconds(), minutes(), hours() and days() into their datetime.timedelta equivalents. Consolidated the bogus email address exceptions. In some places where appropriate, use email 4.0 module names instead of the older brand. Switch from Mailman.Utils.unique_message_id() to email.utils.make_msgid() everywhere. This is because we need to allow sending not in the context of a mailing list (i.e. domain-wide address confirmation message). So we can't use a Message-ID generator that requires a mailing list. OTOH, this breaks Message-ID collision detection in the mail->news gateway. I'll fix that eventually. Remove the 'verified' row on the Address table. Now verification is checked by Address.verified_on not being None.
* Update copyright years.bwarsaw2007-01-191-1/+1
|
* Massive conversion process so that Mailman can be run from a user specifiedbwarsaw2006-07-081-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* - Convert all logging to Python's standard logging module. Get rid of allbwarsaw2006-04-171-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-12/+5
| | | | | | | | | | | - 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-5/+8
|
* FSF office has moved. chdcking in for MAIN branch.tkikuchi2005-08-271-1/+1
|
* _dispose(): mlist.nntp_host may now be a host:port pair.bwarsaw2003-05-121-7/+16
| | | | Use True/False where appropriate.
* prepare_message(): If the newsgroup is moderated, news_moderation is 1bwarsaw2002-10-191-1/+7
| | | | | | | or 2, and we remove any existing Approved header, replacing it for one of our own, pointing to the posting address. Also, a pychecker fix.
* prepare_message(): In Python 2.2 and beyond,bwarsaw2002-08-161-1/+2
| | | | | | | | email.Iterators.body_line_iterator() will return a generator, which isn't len()'able directly, so we need to convert it to a list first, and then get the resulting len. Closes SF bug #593454.
* Allow postings gatewayed to Usenet to inhibit the Subject: fieldbwarsaw2002-07-311-0/+6
| | | | | | | | | 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. prepare_message(): Restore the original Subject: header if news_prefix_subject_too is false.
* _dispose(): Since the runner doesn't normally need to lock the list,bwarsaw2002-04-011-0/+2
| | | | call mlist.Load() so we can be sure we've got the most current state.
* 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.)
* _dispose(): We need to use msg.as_string() to flatten the message tobwarsaw2002-02-261-2/+2
| | | | | | plain text instead of msg.__str__(), otherwise we'll get the Unix From_ header in the output, which will bollux up NNTP. Bug discovered and fix verified by Ron Jarrell.
* prepare_message(): Support the cleaning of headers based onbwarsaw2001-10-121-20/+16
| | | | | NNTP_REMOVE_HEADERS and NNTP_REWRITE_DUPLICATE_HEADERS as a more general approach.
* prepare_message(): mimelib -> email.bwarsaw2001-10-091-1/+1
|
* prepare_message(): Remove X-Trace: and NNTP-Posting-Host: headers,bwarsaw2001-10-011-5/+5
| | | | | since some nntpd servers will complain about these if they exist, and will reject the message posting.
* Convert from mimelib to email.bwarsaw2001-10-011-10/+5
| | | | | Also, use cStringIO directly instead of our own hack-around StringIO module.
* Add back COMMASPACE to globals, as it apparently *is* used, just nottwouters2001-07-101-1/+3
| | | | | | correctly. prepare_message(): 'COMMA' -> 'COMMASPACE'
* Move COMMASPACE global from NewsRunner.py (where it isn't used) totwouters2001-07-101-2/+0
| | | | | | 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!
* prepare_message(): Use Utils.unique_message_id() to generate thebwarsaw2001-07-061-6/+13
| | | | | | | | Message-ID header. mcre: Message-ID headers crafted by Mailman now include a serial number. Recognize this, and also use a verbose regular expression so it's not so cryptic.
* Better syslog() calling conventions.bwarsaw2001-06-271-4/+6
|
* intermediatebwarsaw2001-02-151-24/+122
|
* Multiple queue runner classes, in a new package Mailman.Queue.bwarsaw2000-12-201-0/+47
Runner is the base class providing the framework for other qrunner specializations. IncomingRunner runs through qfiles/in taking messages from the smtpd, sending them through the standard message handler pipeline and potentially writing the message to qfiles/out or qfiles/news. OutgoingRunner takes message from qfiles/out and hands them over to the MTA. NewsRunner takes message from qfiles/news and hands them over to the news server.