summaryrefslogtreecommitdiff
path: root/Mailman/Handlers/Hold.py
Commit message (Collapse)AuthorAgeFilesLines
* Bye bye Hold handler.Barry Warsaw2008-02-011-261/+0
|
* Move the suspicious header check to a rule and add a doctest.Barry Warsaw2007-12-291-10/+0
|
* Add a rule and doctest for newsgroup moderation.Barry Warsaw2007-12-291-4/+0
|
* Port the maximum message size check to a rule. Add doctest.Barry Warsaw2007-12-291-16/+0
| | | | | | | | Rename the implicit.txt doctest. specialized_message_from_string(): Mimic the way the text->message parser will include the size of the original text as an attribute on the message object. The maximum message size rule will use this information.
* Port the implicit destination checking to the rules infrastructure and add aBarry Warsaw2007-12-291-11/+1
| | | | | | bunch of doctests. Note that the old Hold Notification tests are temporarily disabled as these will have to be rewritten when the rule matching logic gets added.
* Convert the max-recipients check from the Hold handler to the max_recipientsBarry Warsaw2007-12-291-9/+0
| | | | rule. Add doctest as appropriate.
* Convert the administrivia check from the Hold handler to the administriviaBarry Warsaw2007-12-291-5/+0
| | | | | | rule. Add doctest as appropriate. DEFAULT_MAIL_COMMANDS_MAX_LINES -> EMAIL_COMMANDS_MAX_LINES
* Initial pylint/pyflakes cleanupBarry Warsaw2007-11-171-2/+3
|
* Complete the port to Storm, at least as far as the current Mailman test suiteBarry Warsaw2007-11-171-2/+1
| | | | | is concerned. This still requires a minor patch to Storm to handle timedelta types in SQLite.
* OMGW00T: After over a decade, the MailList mixin class is gone! Well,Barry Warsaw2007-09-211-7/+10
| | | | | | | | | | | | 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.
* Implement a context manager for Python 2.5's with statement, which isBarry Warsaw2007-09-191-5/+3
| | | | | | | | used where we used to do a try/except to temporarily change the global translation language. This makes the code shorter and cleaner. E.g. with i18n.using_language(another_language): # do something
* Finish clean up of ListAdmin class removal. Start by actuallyBarry Warsaw2007-09-161-1/+2
| | | | | | | | | | | | | | | removing the module. Then, fix a few tests that failed as a result of this work. Mailman/Handlers/Hold.py: Call hold_message() instead of mlist.HoldMessage(). The message store also no longer requires a Date: header, so clean up a few tests that were still expecting that. Extend cleaning_teardown() in test_documentation.py so that both the message store and any list-centric requests are cleaned up after each test.
* Refactor IDatabase interface so that the user_manager, list_manager,Barry Warsaw2007-08-021-2/+2
| | | | | message_store, and pendings 'databases' hang off the IDatabase object attached to the config object. For IPending, no adaptation is necessary.
* Repair some test suite regressions.Barry Warsaw2007-08-011-5/+15
|
* Move the pending database into the SQLAlchemy/Elixir layer. The oldBarry Warsaw2007-08-011-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Convert TestHold to a doctest and update code as necessary. No generalBarry Warsaw2007-07-031-8/+13
| | | | modernization of Hold.py was performed.
* Test suite repair. All tests are now passing again.bwarsaw2007-03-211-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
|
* Upgrade to email package version 4.0.1. Because email 4.0.1 is onlybwarsaw2006-07-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | compatible back to Python 2.3, this change should not get back ported to Mailman 2.1. Port to Python 2.5. The non-test suite changes should get back ported to Mailman 2.1 (which I will do next), but don't worry about the test suite ones because MM2.1's test suite is hopeless. Specifically: - In SecurityManager.py, fix the parsecookie() code to work with Python 2.5 generated cookie text. The latter was changed to be more RFC compliant so it does not output training semicolons for each line of cookie text. This broke the splitting rules, so now first split on newlines, then on ';\s*'. This should work across all Python versions. - In Python 2.5, exceptions are new-style, and thus are no longer of ClassType. The instantiation type test in hold_for_approval() was too naive. - Raising strings generates deprecation warnings in Python 2.5. Switch the one weird use of this in Utils.py to use a class exception. Don't call it "quick exit" though because it's probably not. - In the tests, use True/False instead of 1/0 - Use failUnless/failIf instead of assertEqual against True/False. - In the tests, use Message.get_content_type() instead of Message.get_type() since the latter is gone in email 4.0.1. Same with get_content_maintype() and get_main_type().
* Fix test_message.py by finishing the wind-through of the configuration objectbwarsaw2006-07-081-2/+1
| | | | | | | | | | | | | | | | 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
* Added Date and Message-ID headers to the confirm replymsapiro2006-04-171-0/+2
| | | message that Mailman adds to the admin notification.
* - Convert all logging to Python's standard logging module. Get rid of allbwarsaw2006-04-171-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Port Mark Sapiro's patch for including the preamble and epilogue sizes inbwarsaw2005-09-191-2/+6
| | | | | message size calculations (and a few others) from the 2.1 maintenance release.
* back porting from 2.1.6tkikuchi2005-08-281-5/+10
|
* FSF office has moved. chdcking in for MAIN branch.tkikuchi2005-08-271-1/+1
|
* whitespace normalizationbwarsaw2003-03-101-3/+3
|
* Add Message-Id to (some) logmessages. SF patch #673294, Add message-id totwouters2003-03-101-1/+3
| | | | more log messages, minus an i18nization of 'n/a'.
* Typo fixes, "administator" -> "administrator". Closes SF #650932bwarsaw2002-12-111-1/+1
|
* hold_for_approval(): "rejection-notice" (i.e. the dash) doesn't playbwarsaw2002-11-191-1/+1
| | | | | nice when METADATA_FORMAT = METAFMT_ASCII. This is part of patch #567288 by Maximillian Dornseif.
* ModeratedNewsgroup: New hold class.bwarsaw2002-10-191-5/+12
| | | | | | | | process(): If news_moderation == 2, then always hold the message for moderation, unless of course the message was pre-approved, via an Approved header. Also, whitespace normalization and some pychecker fixes.
* ackp(): New helper function.bwarsaw2002-05-281-1/+11
| | | | | | process(): Before sending the sender a notification message, check the X-Ack: and Precedence: headers, and also see if this sender has reached their auto-response limit.
* hold_for_approval(): Get the sender address from the msgdatabwarsaw2002-05-071-1/+1
| | | | | | | | | | | dictionary's `sender' key, or the msg.get_sender() if not available. This lets exceptions pass the sender through the metadata dictionary. Used by Moderate.py to specify the failing address as retrieved from get_senders() -- note the plural -- which has a different lookup scheme than get_sender(). Moderate.process(): Set the tested sender address in the msgdata's dictionary.
* Update a comment.bwarsaw2002-05-021-3/+1
|
* process(): When doing the the TooManyRecipients test, use >= as thebwarsaw2002-04-111-1/+1
| | | | | | | comparison. The online help says: If a posting has this number, or more, of recipients, it is held for admin approval. Use 0 for no ceiling.
* hold_for_approval(): Mentor Cana notices that we need to use attach()bwarsaw2002-04-111-3/+3
| | | | for the deprecated add_payload().
* 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).
* hold_for_approval(): We don't need to remove the charset (in the outerbwarsaw2002-03-121-2/+0
| | | | | | | admin notification message on holds) by calling set_charset(None). Because we're not passing anything on the `text' argument to the UserNotification constructor, no charset will get automatically added.
* hold_for_approval(): When crafting the notification message destinedbwarsaw2002-03-111-0/+2
| | | | | for the list owner, unset the charset parameter on the multipart/mixed Content-Type: header.
* hold_for_approval(): Instead of using add_header to set to set thebwarsaw2002-02-281-4/+3
| | | | | | | Content-Type: header, and since we should be setting the charset anyway, on the message that goes to the admin, set the lang argument to the UserNotification, and then just set the type (via set_type()) to multipart/mixed.
* process(), hold_for_approval(), do_discard(): When creating thebwarsaw2002-02-111-3/+1
| | | | | | | | 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.
* hold_for_approval(): Add Content-Type: header with the proper charsetbwarsaw2002-01-061-3/+5
| | | | to the admin message we send out.
* hold_for_approval(): In setting up the initial interpolationbwarsaw2001-11-211-1/+1
| | | | dictionary, translate `reason' through i18n.
* process(): Remove the conditional tests for forbidden_posters,bwarsaw2001-10-151-46/+29
| | | | | | | | | | | | | | moderated, member_posting_only, and posters. All these are replaced by the new sender-centric moderation tests in Moderate.py. hold_for_approval(): When sending the hold notification to the list admin, structure the message into a 3-part multipart/mixed: - the text/plain hold notification message as before - an rfc822/message encapsulation of the original held message - an rfc822/message confirmation message, containing the hold cookie, to which the list admin can respond to approve or discard the held message.
* Convert from mimelib to email.bwarsaw2001-10-011-17/+9
|
* Convert all `reason' strings from class docstrings to attributes onbwarsaw2001-09-041-16/+17
| | | | | | | | | | the class, already i18n-ified. MessageTooBig.reason_notice(): Add this instead of setting a reason attribute, so that the proper i18n interpolation can occur. hold_for_approval(): Don't i18n-ify rejection-notice and don't str()-ify the reason string. Just send both through Utils.wrap().
* hold_for_approval(): dont_respond_to_post_requests =>bwarsaw2001-08-171-1/+1
| | | | respond_to_post_requests
* hold_for_approval(): When holding the message for approval, generate abwarsaw2001-07-301-1/+6
| | | | | | cookie referencing the held request id. Include this cookie in the postheld.txt message sent to the user. This allows them to cancel the posting if done before the moderator disposes it.
* hold_for_approval(): Another step towards conversion to MemberAdaptorbwarsaw2001-07-291-1/+1
| | | | API. GetPreferredLanguage() -> getMemberLanguage()
* All membership related attribute access should use the MemberAdaptorbwarsaw2001-07-191-1/+1
| | | | | | | | | | | | API instead, e.g. GetUserOption() -> getMemberOption() GetPreferredLanguage() -> getMemberLanguage() IsMember() -> isMember() GetDigestDeliveryMembers() -> getDigestMemberKeys() ToDigest.py: clear the one_last_digest() dictionary after sending the digest.
* hold_for_approval(): Inside admin_immed_notify (i.e. when we'rebwarsaw2001-07-131-1/+1
| | | | | | | | | | | notifying the administrator of the held message), use the list's preferred_language to get the charset. This fixes the UnboundLocalError that occurs if dont_respond_to_post_requests and admin_immed_notify are both true (it shouldn't have been using `lang' in the first place, since that's the /user's/ preferred language, not the admin's). Bug found by Mentor Cana.