summaryrefslogtreecommitdiff
path: root/Mailman/Handlers/CookHeaders.py
Commit message (Collapse)AuthorAgeFilesLines
* Reorganize doctests, moving handler documentation into Mailman/handlers/docs.Barry Warsaw2008-01-241-338/+0
| | | | Rename all handlers to be more PEP 8 friendly, i.e. lowercased.
* Update copyright years. Change a plugin name.Barry Warsaw2008-01-131-1/+1
|
* Add an interface IArchiver which is used to calculate urls and send messagesBarry Warsaw2008-01-131-4/+12
| | | | | | | | | | to the archiver. Also add a plugin architecture for easily overriding the archiver, and hook this into the setup.py script. Updated CookHeaders.py and Scrubber.py handlers to use the plugged archiver. Updated doctests as appropriate. Fix a typo in the setup.py file.
* Remove the action.py module, move this to Mailman/interfaces/__init__.py.Barry Warsaw2007-10-101-3/+3
| | | | | | Convert IMailingList.personalize to a enum. Change all non-obsolete occurances of GetListEmail() to posting_address.
* Reorganize the enums so that they live in the most appropriate interface. TheBarry Warsaw2007-10-091-1/+1
| | | | only constant left in Mailman.constants is now actually a constant.
* OMGW00T: After over a decade, the MailList mixin class is gone! Well,Barry Warsaw2007-09-211-1/+2
| | | | | | | | | | | | 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.
* Convert the CookHeaders tests in test_handlers to using doctests, split upBarry Warsaw2007-06-211-25/+21
| | | | | | | | | | | | | | | | | into several sub-documents. Defaults.py.in: Removed OLD_STYLE_PREFIXING. So-called 'new style' prefixing is the default and only option now. CookHeaders.py is updated to the new API and some (but not all) of the code has been updated to more modern Python idioms. reply_goes_to_list attribute has been changed from a strict integer to a munepy enum called ReplyToMunging. RFC 2369 headers List-Subscribe and List-Unsubscribe now use the preferred -join and -leave addresses instead of the -request address with a subject value.
* CookHeaders.py:tkikuchi2007-03-241-20/+3
| | | | | | | | | Subject munging code made unified for both i18n and ascii encodings. test_handlers.py Adding test code for i18n and numbering subject munging. (also tab normalization for the last commit)
* Test suite repair. All tests are now passing again.bwarsaw2007-03-211-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - In i18n.py, change this method so that everything it returns will be guaranteed to be a unicode. Mailman 2.2 will be unicode-safe, meaning all strings internally will be unicodes. The translation service is one boundary point were strings come from the outside, so ensure that they are unicodes and convert if necessary. This may break some things, but it's better to fix those situations than to continue to return 8-bit strings from _(). - In Mailman/testing/base.py, craft a fake module called Mailman.MTA.stub and stick no-op functions on stub.create() and stub.remove(). We really don't need the MTA modules for testing purposes (yet at least), and if you're using the default configuration, you'll get tons of cruft on stdout when the Manual MTA tries to add and remove mailing lists. Set up the test configuration environment to use this stub MTA module. - In test_handlers.py, remove an extraneous str(). - Convert ToDigest.py, Hold.py and Acknowledge.py to __i18n_templates__. (I'm pretty darn close to just making everything use $-strings by default.) - In CookHeaders.py, there's no need to unicode()-ify the subject since that should already be a unicode when passed from _(). - In MailList.py, we can use the str.capitalize() method.
* Update copyright years.bwarsaw2007-01-191-1/+1
|
* Fix test_message.py by finishing the wind-through of the configuration objectbwarsaw2006-07-081-8/+13
| | | | | | | | | | | | | | | | 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
* Remove most uses of the types module, in favor of isinstance checks againstbwarsaw2006-04-171-6/+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-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-10/+2
| | | | | | | | | | | - 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.
* ch_oneline(): Input string variable is overwritten. Also use 'utf-8'tkikuchi2006-02-171-15/+18
| | | | | for multiple charset header for programming convenience and readablity. (We may better use unicode for header munging eventually.)
* Backport from 2.1-maint.tkikuchi2006-01-041-4/+3
|
* Port cleaning changes forward from 2.1-maint branch.bwarsaw2005-12-301-11/+13
|
* Python interpreter has evolved to be strict on ascii charset range.tkikuchi2005-12-261-20/+13
| | | | | | Subject manipulation should be done in unicode string mode. (temporary change in MAIN because higher version of python should allow simpler algorithms.)
* Finnish dialect of "Re:".tkikuchi2005-11-011-1/+1
|
* back porting from 2.1.6tkikuchi2005-08-281-61/+160
|
* FSF office has moved. chdcking in for MAIN branch.tkikuchi2005-08-271-1/+1
|
* process(): Eliminate extra space in List-IDbwarsaw2003-06-021-1/+1
|
* prefix_subject(): Capture the no-subject header before we decode it.bwarsaw2003-02-231-2/+2
|
* prefix_subject(): If the subject is a Header instead of a string,bwarsaw2003-02-051-1/+4
| | | | stringify it before calling .splitlines().
* prefix_subject(): Supply default argument '' to the get of the subjectbwarsaw2003-01-291-1/+1
| | | | text. You can't splitlines None.
* Some fixes to retain the continuation whitespace on Subject: linesbwarsaw2003-01-241-4/+10
| | | | | | | | | | | | even after adding the prefix. Specifically, uheader(): Accepts a continuation_ws parameter which is passed straight through to the Header constructor call. prefix_subject(): Split the pre-prefixed Subject: header into lines and get the continuation_ws character from the first continuation line (it won't matter if there is no continuation line). Pass this to uheader().
* prefix_subject(): One small patch for when the charset in an RFC 2047bwarsaw2002-12-041-1/+6
| | | | | header isn't known, we fall back to the charset of the list's preferred language, with 'replace' of course.
* process(): Be sure to i18n-ify any headers with milst.description inbwarsaw2002-12-021-2/+4
| | | | them.
* process(): Patch #625482 by Tokio Kikuchi to properly MIME encode thebwarsaw2002-11-191-23/+33
| | | | | | List-Id header when we add the mailing list's description. uheader(), prefix_subject(): Refactored.
* process(): Re-enable the Cc header hacking, but only if personalize ==bwarsaw2002-11-061-21/+17
| | | | 2, meaning "Full Personalization".
* process(): Comment out the rewriting of the CC header for personalizedbwarsaw2002-11-041-10/+14
| | | | | | messages. It was too controversial to do To header rewriting by default, but we might want to re-enabled this for a future version, probably controlled by a configuration variable.
* prefix_subject(): The charsets coming from headerbits can be stringsbwarsaw2002-10-201-0/+2
| | | | in some cases; coerce them to Charset instances.
* prefix_subject(): Do byte string -> unicode string conversionbwarsaw2002-10-171-3/+5
| | | | | correctly, i.e. through the input_codec of the charset, not using the charset directly.
* process(): Two important fixes. First, when adding Cc headers tobwarsaw2002-10-161-16/+26
| | | | | | | | | | personalized messages, be RFC 2822 compliant in that a maximum of one Cc header is allowed. Fortunately we can use the same algorithm as we use for munging Reply-To. Second, make sure the Cc header adding goes in the "if not fasttrack" section so stuff like password reminders and confirmation messages don't get a Cc to the list tacked on. :-o
* process(): If the list is personalized, and the list's posting addressbwarsaw2002-10-151-8/+17
| | | | | | | | is not included in a Reply-To header, copy the posting address into a Cc header, otherwise there's no (easy) way a recipient could reply back to the list. Also, whitespace normalization, and a bit of code cleanup.
* Better support for "funny" characters in subject prefixes.bwarsaw2002-10-021-42/+32
| | | | | | | | | | | | | | | encode_p(): Removed. _isunicode(): Helper for unicode type testing. prefix_subject(): Better algorithm for handling unicode subject prefixes. Now we always set the Subject header to a Header instance if we're adding the prefix. Always convert the prefix and all previous Subject header bits to unicode (possibly with character replacements) so that the Header class does the right thing, i.e. does the us-ascii, charset hint, utf-8 encoding. Because of this, if the list's charset is us-ascii, we'll substitute iso-8859-1 for a slightly wider character coverage.
* prefix_subject(): Elaborate a comment.bwarsaw2002-08-091-1/+3
|
* encode_p(): New helper function.bwarsaw2002-08-091-3/+29
| | | | | | prefix_subject(): Only encode the subject prefix if it's necessary because it contains non-ASCII characters, or the list owner has requested to do so (via encode_ascii_prefixes).
* Allow postings gatewayed to Usenet to inhibit the Subject: fieldbwarsaw2002-07-311-2/+3
| | | | | | | | | 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. prefix_subject(): Stash the original Subject: header in the metadata under the 'origsubj' key.
* subject_prefix(): We're using email 2.2 now so we can remove thebwarsaw2002-07-261-3/+0
| | | | crufty workaround.
* prefix_subject(): This should fix Fil's duplicate encoding problem.bwarsaw2002-07-231-7/+13
| | | | | | | | | | | | | | | | | | Before applying this patch, do this to reproduce the bug: - Set the language to something other than English (French makes a good choice) - Make sure the list has a prefix of some ascii text - Send a message to the list with the following Subject: =?iso-8859-1?Q?=E9?= Bingo, double encoding. This fixes the problem by making sure the prefix + original subject gets properly chunk encoded in a Header instance. There's a bit of extra goo in here that won't be necessary when I release email 2.2. See the comments for details. G'morning Fil! :)
* process(): Implement a suggestion by David W. Tamkin on list-managersbwarsaw2002-07-171-22/+24
| | | | | | | | | | | | | | | | | | | | | | | | (forward by JC Lawrence): Nick gave the example, | > Reply-to: listname@listdomain, posting-user@example.com JCL commented, | Having [mutiple addresses in] Reply-To is a Good ... and Damned Useful [Thing]. It seems to me, though, that the list membership would be better served with this form: Reply-To: postauthor@its.domain, listname@listserver.domain because the MUAs with which I'm familiar make it anywhere from slightly easier to far easier for the respondent to remove addresses from the right of the reply's To: than from the left. Also clean up some Pychecker nits.
* process(): Use Precedence: list instead of bulk for mail list explodedbwarsaw2002-05-221-17/+8
| | | | | | | | messages. prefix_subject(): Since email.Header.Header.encode() already knows how to split long header lines, use this instead of our own attempts. This makes long subject lines much cleaner.
* process(): Only add List-Post: if include_list_post_header is true.bwarsaw2002-04-191-1/+3
|
* process(): We need to clean up the base archive url in two ways:bwarsaw2002-04-111-1/+4
| | | | | first, remove any trailing slash, second surround the url in angle brackets.
* process(): As Mentor Cana points out, dump_address_pair() isbwarsaw2002-04-111-1/+1
| | | | deprecated in favor of formataddr().
* process(), prefix_subject(): Ben Gertzfield's patch (refactored bybwarsaw2002-04-081-13/+44
| | | | | Barry) which correctly checks for the prefix in encoded Subject: headers.
* process(): In response to bug #223533, we're changing when the RFCbwarsaw2002-04-081-9/+16
| | | | | | | | | | | | 2919 and 2369 headers are added. - List-Id: is always added - List-Post:, List-Help:, List-Subscribe:, List-Unsubscribe:, and List-Archive: are only added to posting messages. - X-List-Administrivia: is only added to message Mailman creates and sends out of its own accord.
* process(): We don't need to do a ValidateEmail() on thebwarsaw2002-03-121-6/+1
| | | | | reply_to_address since, as the note says it's better to validate it on entry, and we now have the architectural support for doing that.
* process(): To support VERP+personalizing in SMTPDirect.py, we nobwarsaw2002-03-091-7/+1
| | | | longer munge the Sender: or Errors-To: headers in this module.