summaryrefslogtreecommitdiff
path: root/Mailman/OldStyleMemberships.py
Commit message (Collapse)AuthorAgeFilesLines
* Removed a bunch of files that are obsolete. The interfaces are all foldedBarry Warsaw2007-09-271-379/+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.
* Major surgery to get the setuptools based installation passing all theBarry Warsaw2007-07-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | existing unit tests. Here's a summary of the changes. - Removed all dependent third party packages, since the setup.py file now claims all package dependencies such that they can be automatically installed from the cheeseshop. - Moved the misc directory into the Mailman package as Mailman/data. Moved templates and messages to Mailman subpackages. - Added an ILanguageManager interface, plus an implementation, so that we don't use Defaults.LC_DESCRIPTIONS directly anymore. Added a doctest for this interface and implementation. Defaults.LANGUAGES is moved into mailman.cfg. Defaults.LANGUAGE_DICT is moved to _DEFAULT_LANGUAGE_DATA, and LC_DESCRIPTIONS is removed. The calculation of the available and enabled languages is moved to the Configuration class, but this will probably still need work. Utils.GetLanguageDescr() and Utils.IsLanguage() are removed. I'd like to remove GetCharSet() eventually too, but there are too many uses of this currently, so I'm deferring it. - Utils.findtext(): Hacks added so that templates can be retrieved from the language catalog. The hack is that the template contents are used to find the translation, but in the one test case where this is actually flexed, the trailing newline in the file contents has to be trimmed. This is probably not right. - No more Defaults.py.in or mm_cfg.py! Defaults.py.in is moved to Defaults.py and is no longer created from a template file. The script called make_instance is added which creates an etc/mailman.cfg file from mailman.cfg.in (previously, mailman.cfg.sample) and /that/ file now has the small number of calculated values. In general, make_instance will not touch mailman.cfg if it exists, unless the --force option is given. CGIEXT is made the empty string by default (i.e. not generated). make_instance grows a --var-dir option. Fleshed out the --languages opton. - Defaults.py grows a DEFAULT_VAR_DIRECTORY variable, which is the default location of the 'var' directory. The Configuration class uses this as one of the directories it searches for its landmark, i.e. etc/mailman.cfg. RUNTIME_DIR is gone, as is VAR_PREFIX. - testall needs to write MAILMAN_USER, MAILMAN_UID, MAILMAN_GROUP, MAILMAN_GID, and LANGUAGES run time variables. - bin/withlist no longer needs to add config.BIN_DIR to sys.path, because in fact that variable doesn't exist any more. - Tweak the French catalog to make a test work. This is needed because of the conversion from %-strings to $-strings. - The setup.py now generates the .mo files before it does its thing. This will have to be fixed, but for now we must generate these files on setup build time instead of installation time. - Removed an unused interface.
* - Fixed a bug in OldStyleMemberships.addNewMember that allowed adding an addressmsapiro2007-03-201-1/+8
| | | | | | | with upper case in the domain if the local part was all lower case. - Changed the semantics of OldStyleMemberships.changeMemberAddress os that in the case of a straightforward address change, i.e. nodelete = 0, delivery status and time are preserved if BYUSER or BYADMIN.
* Rework MailList.available_languages so that we don't need to use a PickleTypebwarsaw2007-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | column in the database for this list of strings. We use SQLAlchemy's many-to-many relationship, however because of this, you cannot simply append new unicodes to .available_languages. You need to wrap the language code in a Language instance and append that instance to the list. In order to handle this, I added a property MailList.language_codes which returns a list of the code strings (not Language instances). Also new are MailList.set_languages() for setting (i.e. overriding) the set of available languages for the list; and add_language() which takes a single language code, wraps it, and appends it. The code does not and should not use .available_languages directory any more. MailList.GetAvailableLanguages() is removed. The 'available_languages' column is removed from the Listdata table. Add a getValue() to Mailman.Gui.Language in order to unwrap the language codes stored in the database's association table. Modify _setValue() to do the wrapping. In dbcontext.py, don't import * from the sqlalchemy package. It contains a 'logging' name which is not the standard Python logging package. I also added essentially a bag of attributes class called Tables which will hold references to all the SA tables that are created. Update the make_table() API to take an instance of Tables. Added a close() method to DBContext. This is needed for the updated unit test suite. Changed bin/import.py so that when available_languages is being set, it calls MailList.set_languages() instead of trying to set that attribute directly. Updated some language idioms while I was at it. More eradication of mm_cfg in favor of the config object and the Defaults module. In testall.py, call initialize() instead of loginit.initialize(). Promote MAX_RESTARTS into a Defaults.py.in variable. This is because the unit tests will knock that value down to something not so annoying should one of the qrunner-required tests traceback. Several other important changes to the unit test suite (which now completely succeeds again!): - Set the uid and gid of the temporary mailman.cfg and tmp*.db files to the Mailman user and group as specified in the config object. - Make sure that all of the tests point to a SQLite database file that was created with the tempfile module. This way we don't pollute our main database with data that is getting created during the unit tests. - In the TestBase.setUp() method, be sure to close the existing dbcontext, clear out the mappers, and then reconnect the dbcontext with the new SQLALCHEMY_ENGINE_URL pointing to the tempfile. However, we don't need to reload the MailList instance any more. - Make all tests work, except for the tests that require crypt. That upgrade path will not be available in this version of Mailman.
* Passwords done right.bwarsaw2007-01-141-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First off, there are several password hashing schemes added including SHA, salted-SHA, and RFC 2989 PBKDF2 (contributed by Bob Fleck). Then we encode the password using RFC 2307 style syntax. At least I think: specifically things like the PRF and iteration count for PBKDF2 are encoded the way I /think/ is intended for RFC 2307 but I could be wrong. Seems darn hard to find definitive information about that. In any event, even though CLEARTEXT passwords are supported, they are mostly deprecated, even for user passwords. It also allows us to easily update all passwords to a new hashing scheme when the existing schemes get cracked. The default scheme (specified in Defaults.py.in) is salted-SHA with a 20 byte salt (the salt length and PBKDF2 iteration counts can only be specified in the passwords.py file). These hashed passwords are used for user passwords, list owner and moderator passwords, and site and list creator passwords. Of course this means that user password reminders are impossible now. They've been ripped out of the code for a while, but now we'll need to implement password resets since user passwords cannot be recovered. bin/export has had several changes: - export no longer converts to dollar strings. Were assuming dollar strings are used by default for all new lists and any imported lists will already be converted to dollar strings. - Likewise, rip out the password scheme stuff, since cleartext passwords can never be exported, so we might as well always include the member's hashed password. - Fix exporting to stdout when that stream can only handle ascii by wrapping stdout in a utf-8 codec writer. Other changes: - add a missing import to HTTPRunner.py - Convert GUIBase.py to use Defaults.* for constants instead of mm_cfg.* - Remove pre-Python 2.4 compatibility from Utils.py. We've already said Python 2.4 will be a minimum requirement. - Change the permissions on the global password file. The default 007 umask is used and should be good enough. - bin/newlist adds the ability to specify the password scheme (or list the available schemes) for the list owner password. It is not possible to set the scheme on a per-list basis. bin/mmsitepass does the same, but for the site and list creator passwords. - Fix a nasty problem with bin/import. The comment in the code says it best: # XXX Here's what sucks. Some properties need to have # _setValue() called on the gui component, because those # methods do some pre-processing on the values before they're # applied to the MailList instance. But we don't have a good # way to find a category and sub-category that a particular # property belongs to. Plus this will probably change. So # for now, we'll just hard code the extra post-processing # here. The good news is that not all _setValue() munging # needs to be done -- for example, we've already converted # everything to dollar strings. - Set the 'debug' logger to logging.DEBUG level. It doesn't seem to make much sense for the debugging log to ignore debug messages.
* Add a framework for easier use of alternative MemberAdaptor implementations.bwarsaw2006-07-161-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | Also add an experimental (and currently non-functioning) SQLAlchemy implementation. The MemberAdaptor.py interface has been updated in a couple of ways. First, a "transaction interface" has been added so that Mailman can properly sync with the member adaptor. Newly supported methods are load(), lock(), save(), and unlock() and these correspond to methods in the MailList object. Second, __init__() is officially documented to take a MailList instance and nothing else. Third, some of the existing docstrings were incorrect w.r.t. the OldStyleMemberships implementation (such as rasing BadPasswordError in some cases). Most of these should not be the responsibility of the MemberAdaptor, so the docstrings have been updated. Test cases have been added and a new Defaults.py.in variable called MEMBER_ADAPTOR_CLASS has been added which names the class to use. Of course OldStyleMemberships are named by default. There's also a SQLALCHEMY_ENGINE_URL variable for use with the experimental member adaptor. Fix a bug in Configuration where if the etc/mailman.cfg file wasn't found and the mm_cfg.py file was used as a fallback, it would blow away the original namespace copied from Defaults.py.in. This wasn't a problem until we started adding additional names to that namespace, such as 'add_domain'.
* Remove most uses of the types module, in favor of isinstance checks againstbwarsaw2006-04-171-7/+7
| | | | | | 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.
* FSF office has moved. chdcking in for MAIN branch.tkikuchi2005-08-271-1/+1
|
* getMemberLanguage(): Check the language retrieved from the member'sbwarsaw2003-02-201-4/+7
| | | | | | | | | | record and if it isn't in the mailing list's list of available languages, return the list's preferred language. This should go a long way towards fixing problems where a user's preferred language is disabled. addNewMember(): Use a slightly more efficient check of the address's membership.
* changeMemberAddress(): Rearrange the order in which sub-tasks arebwarsaw2003-01-021-10/+10
| | | | | | | done. First remove the old member, then add the new member. Also fix the setting of user options so that this is done on the newaddress (lowercased). This should avoid MMAlreadyAMember errors when the address changes by case only.
* Patches to support duplicate suppression for explicit recipients,bwarsaw2002-03-051-0/+4
| | | | | | | | | written by Ben Gertzfield, ported to MM2.1 by Marc MERLIN. Specifically, addNewMember(): Set the member's initial user_options to the list's new_member_options value (if it's non-zero).
* setBounceInfo(): Dan Mick recognized that set/getBounceInfo() weren'tbwarsaw2002-02-091-0/+1
| | | | | operating case insensitively w.r.t. the member key. Coerce the member argument to lower case before it's used.
* removeMember(): Untested patch to clean up bounce_info andbwarsaw2002-02-051-2/+1
| | | | | delivery_status attributes when deleting a member. Don't call setBounceInfo() directly.
* Urg. Bump copyright years.bwarsaw2002-01-291-1/+1
|
* getBouncingMembers(): New interface method to return the list ofbwarsaw2002-01-291-0/+3
| | | | | | members with bounce info. This overlaps w/ getDeliveryStatusMembers() since it will return members who have bounced, but have not yet reached the disable threshold.
* removeMember(): Clear the bounce info before deleting the memberkeybwarsaw2001-12-291-2/+2
| | | | | from the various dictionaries, otherwise the __assertIsMember() in setBounceInfo() will fail.
* getDeliveryStatusMembers(): New interface method which returns a listbwarsaw2001-12-271-7/+13
| | | | | | | | | | | | | | | | of members whose delivery status is in the given argument. This can be used to e.g. find all the members who have been disabled due to excessive bounces. removeMember(): Use setBounceInfo(..., None) to clear a just-removed member's bounce information. MailList.ClearBounceInfo() is gone. setDeliveryStatus(): When setting the member's status to ENABLED, clear all the bounce information by calling setBounceInfo(..., None). This also deletes the member's entry in self.__mlist.delivery_status. setBounceInfo(): Fixed typo, also when info is None, delete the member's entry in the delivery_status dictionary.
* First step on the bounce processer sanity road. These changes fixbwarsaw2001-12-191-2/+47
| | | | | | | | | | | | | | | | | | Mailman to keep track of why (and when) delivery is disabled. New list attribute delivery_status and new MemberAdaptor interface methods are added. Delivery status has the following states: ENABLED, BYUSER (disabled by user selection), BYADMIN (disabled by admin selection), BYBOUNCE (disabled by excessive bouncing), UNKNOWN (legacy disable). We no longer use the DisableDelivery user option. Also, for status changes from <anything> -> <anything-but-ENABLED>, we record the time.time(). This information gets thrown away when the delivery is re-enabled. Specific changes here: getDeliveryStatus(), getDeliveryStatusChangeTime(), getBounceInfo(), setDeliveryStatus(), setBounceInfo(): New implementations matching the interface changes.
* setMemberOption(): Stupid typo preventing users from setting anybwarsaw2001-08-291-3/+3
| | | | options. Caught by Ben Gertzfield.
* getMemberOption(): Whether the user is a digest member or not is notbwarsaw2001-08-161-2/+6
| | | | | | | | | | | | | kept as a bitfield value in user_options, even though there's an mm_cfg.Digests `flag'. So special case asking for this option by checking the `where' value returned by __get_cp_member(). addNewMember(): Similarly, there's no point in setting user_options to mm_cfg.Digests if the member wants to receive digests, since the state of that flag is kept elsewhere. setMemberOption(): More of the same; we can always return from the "if flag == Digests" clause without touching user_options.
* getMemberCPAddress(): Bug fix -- return the case preserved address notbwarsaw2001-08-031-1/+1
| | | | the argument.
* __assertIsMember(): Helper method which raises NotAMemberError if thebwarsaw2001-07-291-11/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | member, er, isn't a member. :) getMemberOption(), getMemberName(), removeMember(), changeMemberAddress(), setMemberPassword(), setMemberLanguage(), setMemberOption(), setMemberName(): Use __assertIsMember(). getMemberLanguage(): If the address isn't a member of the list, return the list's default language instead of raising an exception. getMemberTopics(): New API method which returns the list of topics the member is interested in. addNewMember(): Raise MMAlreadyAMember if the new member address is, er, um, already a member. Also, don't use setMemberOption() to set the mm_cfg.Digests flag because otherwise you'll get an AlreadyReceivingDigests exception. Set the user_options dict directly instead. changeMemberAddress(): Grow a `nodelete' argument, defaulting to 0, which inhibits the normal deletion of the oldaddress after the change (used in bin/clone_members). Also, be sure to convert the fullname from the oldaddress to the newaddress. setMemberTopics(): New API method which sets the list of topics the member is interested in.
* getMemberOption(): flag argument should not have a default value.bwarsaw2001-07-201-3/+3
| | | | | changeMemberAddress(): If user_options doesn't have an entry for memberkey, flags should default to 0, not None.
* intermediatebwarsaw2001-07-181-0/+262