summaryrefslogtreecommitdiff
path: root/Mailman/Handlers
Commit message (Collapse)AuthorAgeFilesLines
* Reorganize doctests, moving handler documentation into Mailman/handlers/docs.Barry Warsaw2008-01-2421-3176/+0
| | | | Rename all handlers to be more PEP 8 friendly, i.e. lowercased.
* Bye bye Hold handler.Barry Warsaw2008-02-011-261/+0
|
* SpamDetect is gone, so the chains/rules implementation experiment is deemed aBarry Warsaw2008-02-011-130/+0
| | | | | | | | | | | | | | | | | | | | success and will now be merged into the trunk. Move the Truth rule into the built-in rules package in a separate module, and add a test. Modify IChainLink so that the rule and chain attributes are not names but indeed the actual ILink or IChain object directly. Update the chains.process() function accordingly. Remove the IChain.get_rule() method. Don't derive BuiltInChain from Chain and don't make it an IMutableChain. It's now just an IChain, and is implemented concretely. Refactor the HeaderMatchChain and friends so that it can be used with both the global HEADER_MATCHES variable and the list-specific header_matches variable, which has exactly the same semantics. Oh yeah, get rid of the list's header_filter_rules attribute and replace it with header_matches so that the semantics match, it's easy to explain, and it's all nice and clean.
* Port header matching previously described by the misnamed KNONW_SPAMMERSBarry Warsaw2008-01-261-8/+0
| | | | | | | | | | | | | | | variable to the new chain processing system. Create a header-matching chain which handles global site header matching rules defined by HEADER_MATCHES. Rip this logic out of the SpamDetect handler; really this entire handler needs to go away but the rest of it isn't ported yet. IChains now have a get_rule() method which allows them to return private (i.e. not globally registered) rules. This is used by the header matching chain. Mailman.app.chains.process() has had its parameter list reordered to be more like all other function signatures that take a mailing list, message, and message metadata.
* More updates to rules and chains, especially by adding additional tests.Barry Warsaw2008-01-212-37/+1
| | | | | | | | | | | | | | | - Remove the Emergency.py handler. This is now covered by the emergency.py rule. - Remove the hold.txt doctest. This is now covered by the chains.txt and emergency.txt doctests. - Added a chains.txt doctest. - Extend the pending db to handle list values, although only lists that contain nothing but strings. - Rename the 'adminapproved' message metadata key (for the emergency rule) to 'moderator_approved'. Also, backport a change to the Decorate handler where message metadata on the 'decoration-data' key ca be used in the header and footer.
* Merge from trunk.Barry Warsaw2008-01-143-12/+21
|\
| * Update copyright years. Change a plugin name.Barry Warsaw2008-01-133-3/+3
| |
| * Add an interface IArchiver which is used to calculate urls and send messagesBarry Warsaw2008-01-133-9/+18
| | | | | | | | | | | | | | | | | | | | 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.
* | 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
* | Convert the Approve.py handler to an approved.py rule. Update the doctest toBarry Warsaw2007-12-291-116/+0
|/ | | | | | | | | use the rule check instead of handler processing. Add a test for stripping the header from the text/html part to the doctest. Add Mailman.app.rules.find_rule() to return a named rule. Fix a few typos.
* Convert to the Storm Python ORM <storm.canonical.com>. There were severalBarry Warsaw2007-11-182-8/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reasons for this, but most importantly, the changes from SQLAlchemy/Elixir 0.3 to 0.4 were substantial and caused a lot of work. This work unfortunately did not result in a working branch due to very strange and inconsistent behavior with Unicode columns. Sometimes such columns would return Unicode, sometimes 8-bit strings, with no rhyme or reason. I gave up debugging this after many hours of head scratching. Oh yeah, no more flush! Storm enforces Unicode columns, which is very nice, though requires us to add lots of 'u's in places we didn't have them before. Ultimately, this is a good thing so that the core of Mailman will be Unicode consistent. One thing I still want to clean up after this, is the function-scoped imports in the model code. Part of the reason for the separate model classes was to avoid this, but for now, we'll live with it. Storm's architecture requires us to maintain a database-table-class registry for simple clearing after tests in Database._reset(). This is made fairly simple by Storm allowing us to use our own metaclass for model classes. Storm does require that we write our own SQL files, which is a downside, but I think our schema will be easy enough that this won't be a huge burden. Plus we have a head-start <wink>. Another cool thing about Storm is the explicit use of stores for objects. This should eventually allow me to flesh out my idea of storage pillars for 1) lists, 2) users, 3) messages. Some other changes: - pylint and pyflakes cleanups - SQLALCHEMY_ENGINE_URL -> DEFAULT_DATABASE_URL - Don't import-* from Version in Defaults.py - Add interface method to Mailman.Message.Message so that __getitem__() and get_all() always return Unicode headers, even when the underlying objects are strings. This should generally be safe as headers are required by RFC to be within the ASCII range. - Fix bin/arch.py to use proper initialization.
| * Initial pylint/pyflakes cleanupBarry Warsaw2007-11-172-6/+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.
* | - Scrubber.pyMark Sapiro2007-11-061-5/+6
|/ | | | | | | | Fixed an issue where an implicit text/plain part without any headers gets lost. Moved the cleansing of the filename extension to a place where it is guaranteed to be a string as opposed to an empty list.
* Much progress, though not perfect, on migrating to SQLAlchemy 0.4 and ElixirBarry Warsaw2007-10-311-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.4. Lots of things changes, which broke lots of our code. There are still a couple of failures in the test suite that I don't understand. It seems that for pending.txt and requests.txt, sometimes strings come back from the database as 8-bit strings and other times as unicodes. It's impossible to make these tests work both separately and together. users.txt is also failing intermittently. Lots of different behavior between running the full test suite all together and running individual tests. Sigh. Note also that actually, Elixir 0.4.0 doesn't work for us. There's a bug in that version that prevented zope.interfaces and Elixir working together. Get the latest 0.4.0 from source to fix this. Other changes include: - Remove Mailman/lockfile.py. While I haven't totally eliminated locking, I have released the lockfile as a separate Python package called locknix, which Mailman 3.0 now depends on. - Renamed Mailman/interfaces/messagestore.py and added an IMessage interface. - bin/testall raises turns on SQLALCHEMY_ECHO when the verbosity is above 3 (that's three -v's because the default verbosity is 1). - add_domain() in config files now allows url_host to be optional. If not given, it defaults to email_host. - Added a non-public interface IDatabase._reset() used by the test suite to zap the database between doctests. Added an implementation in the model which just runs through all rows in all entities, deleting them. - [I]Pending renamed to [I]Pended - Don't allow Pendings.add() to infloop. - In the model's User impelementations, we don't need to append or remove the address when linking and unlinking. By setting the address.user attribute, SQLAlchemy appears to do the right thing, though I'm not 100% sure of that (see the above mentioned failures).
* General cleanups some of which is even tested <wink>. Mailman.LockFile moduleBarry Warsaw2007-10-101-7/+4
| | | | | | | | | | | | | is moved to Mailman.lockfile. Remove a few more MailList methods that aren't used any more, e.g. the lock related stuff, the Save() and CheckValues() methods, as well as ChangeMemberName(). Add a missing import to lifecycle.py. We no longer need withlist to unlock the mailing list. Also, expose config.db.flush() in the namespace of withlist directly, under 'flush'.
* Remove the action.py module, move this to Mailman/interfaces/__init__.py.Barry Warsaw2007-10-103-6/+8
| | | | | | 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-093-3/+3
| | | | only constant left in Mailman.constants is now actually a constant.
* Changes to support the Approved/Approve header with the new userBarry Warsaw2007-10-061-38/+26
| | | | | | | | | | model. Specifically, where a mailing list used to have both a password and a moderator password, both of which could be used in the Approved header, now a mailing list has only a shared moderator password. This moderator password's only purpose in life is to allow for Approved header posting. test_handlers.py is now completely ported to doctests, so it's removed.
* Reorganize the qrunner infrastructure. First, the package has been renamedBarry Warsaw2007-09-295-10/+10
| | | | | | | | | | | | | | | | | | | | | | 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.
* Removed a bunch of files that are obsolete. The interfaces are all foldedBarry Warsaw2007-09-271-1/+0
| | | | | | | | | | | | | into the IMailingList interface. OTOH, MemberAdaptor.py is completely useless now (though not entirely eradicated), as is OldStyleMemberships.py. versions.py isn't necessary any longer either because we'll have to do database migrations (and conversions from MM2.1) completely differently. New command line script 'set_members' which is used to take a CSV file and syncing that to a list's membership. Added back the DeliveryStatus.unknown item because we'll need it when we migrate MM 2.1 databases.
* OMGW00T: After over a decade, the MailList mixin class is gone! Well,Barry Warsaw2007-09-215-14/+22
| | | | | | | | | | | | 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-192-10/+6
| | | | | | | | 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-013-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* The start of a setuptools conversion. All the Makefile.in and autoconfBarry Warsaw2007-07-131-70/+0
| | | | artifacts are removed, as is the C files which we will no longer need.
* Convert the Scrubber test to a doctest, and fix Scrubber.py, but otherwiseBarry Warsaw2007-07-121-13/+14
| | | | | | | | don't modernize the Scrubber handler. The is the last of the handler test conversions until we figure out what to do with the Approve handler. In a unified user database the semantics of this are unclear.
* Convert ToArchive tests to doctests and do a minimal amount of handler moduleBarry Warsaw2007-07-111-4/+1
| | | | cleanup (really, not much was necessary).
* Conversion of the ToDigest tests to doctests, along with just enough handlerBarry Warsaw2007-07-101-24/+36
| | | | | | | | | module update to make the thing pass. Much more coverage is still necessary, but this at least recreates the existing tests. Changes to the test infrastructure to make REPORT_ONLY_FIRST_FAILURE conditional on lower (default) verbosity. Increase the verbosity via 'bin/testall -v' and you get all the failure output.
* Convert ToOutgoing handler to a doctest. Minor cleanup of the handler code toBarry Warsaw2007-07-081-1/+1
| | | | a more modern Python style.
* Convert TestHold to a doctest and update code as necessary. No generalBarry Warsaw2007-07-031-8/+13
| | | | modernization of Hold.py was performed.
* Convert TestFileRecips to a doctest, and update the handler to more modernBarry Warsaw2007-07-021-14/+11
| | | | | | | | Python idioms. The recipients are now returned as a set instead of a list, so duplicates are quashed. In MailList.InitTempVars() we need to create the list's data directory when the list is initialized. If the directory already exists, this does nothing.
* merging 3.0Barry Warsaw2007-06-221-12/+16
|\
| * Scrubber.py - Malformed RFC 2047 encoded filename= parameter can haveMark Sapiro2007-06-221-12/+16
| | | | | | | | | | | | | | | | a null byte or other garbage in the extension. Cleaned this. - Improved handling of None payloads. - Cleaned up a few charset coercions. OutgoingRunner.py - Made probe bounce processing and queuing of bounces conditional on having some permanent failure(s).
* | Convert the AvoidDuplicates handler tests to a doctest. Well,Barry Warsaw2007-06-211-32/+34
| | | | | | | | | | | | | | actually there /was/ no separate AvoidDuplicates test, but now there is, even though it may not be full coverage. Update the AvoidDuplicates handler to use more modern Python idioms.
* | 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.
* | Convert the Cleanse handler tests to doctest style.Barry Warsaw2007-06-191-3/+3
| |
* | Convert the tests for the CalcRecips handler to doc tests. There areBarry Warsaw2007-06-191-19/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | some XXX's in the doc test because digest recipients aren't tested (though those may go in a different doctest), and neither are urgent messages. This latter is for the same reason that the Approved handler is not yet tested; which password do you use in that header? The CalcRecips tests would also seem the natural place to test the receive_list_copy preference, but that actually gets processed in the AvoidDuplicates handler, so it isn't tested here. Add delivery_status (of type enum DeliveryStatus) to preferences. I'm not entirely sure that's the right place for it, but it lets me finish converting the test for now. Expose the rest of the preferences through the IMember interface.
* | Convert the AfterDelivery handler test to a doctest. Also, change theBarry Warsaw2007-06-181-2/+2
| | | | | | | | | | MailingList.last_post_time column to a DateTime (i.e. Python datetime object).
* | Remove both the model and interface for RosterSets. These are no longer usedBarry Warsaw2007-06-181-11/+11
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | or necessary in the current data model. Convert the test_handlers.py Python test to an acknowledge.txt doctest, and make the Acknowledge.py handler work with the new data model. There are a few XXX comments left in here due to the fact that the web stuff is a total hack in the current branch currently. Added IMailingListWeb methods and properties to the MailingList model class: web_host and script_url(). Work out how IMembers will expose the lookup-order based preferences. By getting the attribute IMember.preferences you can see exactly the preferences overridden by this member. To use the lookup order, use IMember.delivery_mode, IMember.acknowledge_posts, etc. IOW, the IMember interface now provides the properties directly and access through this mechanism supports lookup order with definitive preference values. Also added IMember.unsubscribe() which does the obvious, and IMember.options_url() which is a total hack for providing a url (but not the ultimately right one) for the user's option page. Refactor the model's roster classes. Also added IRoster.get_member() method with efficient queries to return the right results. Make AdministratorRoster.members more efficient due to a better query. Update the membership.txt doctest to eliminate a chance ordering effect, and also to test finding members with .get_member(). The clean up section uses the new .unsubscribe() method.
* Improved processing of an Approve(d): body line by decoding the body payloadmsapiro2007-06-091-5/+21
| | | before looking for/deleting the Approve(d): line.
* Add doctest for Replybot handler. The test in test_handlers.py didn't reallybwarsaw2007-05-311-27/+14
| | | | | | | | | do anything. The doctest needs to have some way of testing the grace period, but it's still more tests of the module than there every was before. Update the Replyboty handler to use $-strings internally. Eliminate the use of %-strings in auto-response textsy. Only $-strings can be used, which allows us to get rid of another use of SafeDict.
* Go ahead and remove the Mailman/database/tables directory since all the Elixirbwarsaw2007-05-301-38/+25
| | | | | | | | | | | | | | | | | | classes live in Mailman/databae/model now. Remove the TestDecorate test class from test_handlers.py and move them into a doctest called decorate.txt (with harness in test_decorate.py). Remove the dependence on SafeDict from the Decorate handler because I can now use string.Template object to safely fill in header and footer templates. Eventually I want to completely remove SafeDict from Mailman, but it's still used in a few other places. This also means that only $-strings will be supported in headers and footers, and the import script will have to convert %-strings to $-strings. Also, '_internal_name' is no longer a supported header/footer substitution variable. Use $real_name or $list_name now. Added $fqdn_listname as a substitution variable. Update the DEFAULT_MSG_FOOTER accordingly.