summaryrefslogtreecommitdiff
path: root/Mailman/Cgi/subscribe.py
Commit message (Collapse)AuthorAgeFilesLines
* Bite the bullet: rename the Mailman package to mailman.Barry Warsaw2008-02-271-252/+0
|
* Tweak copyright years.Barry Warsaw2008-02-071-1/+1
|
* 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
* Move the pending database into the SQLAlchemy/Elixir layer. The oldBarry Warsaw2007-08-011-8/+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.
* 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.
* Other than contrib files, convert all imports of mm_cfg to imports of config.Barry Warsaw2007-07-141-5/+5
| | | | | | | | | | | Ignore mailman.egg-info In bin/make_instance.py: Catch and ignore import errors when importing Mailman.i18n. Before this script has actually been run, there won't be enough infrastructure in place of the import to succeed. Include several other fixes in this file. Add install_requires to the setup script.
* Update copyright years.bwarsaw2007-01-191-1/+1
|
* Merged revisions 8113-8121 via svnmerge from bwarsaw2006-12-291-20/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://mailman.svn.sourceforge.net/svnroot/mailman/branches/tmp-sqlalchemy-branch ................ r8114 | bwarsaw | 2006-12-06 00:16:54 -0500 (Wed, 06 Dec 2006) | 44 lines Initial take on using SQLAlchemy to store list data in lieu of Python pickles. While all the list data (including OldStyleMemberships attributes) are stored in the database, many attributes are stored as PickleTypes binary data. This isn't idea but it gets things working until a more sophisticated schema can be developed. MailList class is now a new-style class, as is required by SQLAlchemy. This makes several things, er, interesting. Rip out all the low-level pickle reading and writing stuff. Hook SA transaction events into Lock() and Unlock(). Move the hooking of the _memberadaptor into InitTempVars(), which gets called by the SQLAlchemy hooks (MailList.__init__() never is). Add an initialize.py module which centralizes all the initialization bits that command line scripts have to do, including configuration, logging, and atabase initialization. This change also converts bin/withlist to mmshell wrapper. Update to SQLAlchemy 0.3.1. Revamp paths.py.in considerably. There were several problems with the old way. We no longer disable default loading of site-packages so we don't need to add Python's site-packages back to sys.path. Also, because site.addsitedir() causes things like .pth paths to be /appended/ to sys.path, they actually won't override any site-installed packages. E.g. if SQLAlchemy is installed in the system Python, our version will not override. IIUC, setuptools-based packages can be configured to work properly in the face of package versions, however not all packages we currently depend on are setuptools-based. So instead, we steal a bit of stuff from site.py but change things so the prepend .pth stuff to sys.path. Update several modules to use True/False and whitespace normalization. Convert from mm_cfg to config object. Modernize a few coding constructs. Add a couple of exceptions to handle database problems. In the export script, include the widget type in the elements. This helped in my stupid little throw away conversion script, but I think it will be more generally useful. Add an interact.py module which refactors interactive interpreter access. Mostly this is used by withlist -i, but it lets us import Mailman.interact and drop into a prompt just about anywhere (e.g. debugging). ................ r8115 | bwarsaw | 2006-12-07 09:13:56 -0500 (Thu, 07 Dec 2006) | 22 lines Start to flesh out more of the SQLAlchemy mechanisms. Added a MailList.__new__() which hooks instantiation to use a query on dbcontext to get an existing mailing list. A 'no-args' call means we're doing a Create(), though eventually that will change too. For now, disable the CheckVersion() call. Eventually this will be folded into schema migration. list_exists(): Rewrite to use the dbcontext query to determine if the named mailing list exists or not. Requires the fqdn_listname. Eradicate two failed member adaptors: BDBMemberAdaptor and SAMemberships. Change the way the DBContext holds onto tables. It now keeps a dictionary mapping the table's name to the SA Table instance. This makes it easier to look up and use the individual tables. Add 'web_page_url' as an attribute managed by SA, and remove a debugging print. ................ r8116 | bwarsaw | 2006-12-11 07:27:47 -0500 (Mon, 11 Dec 2006) | 29 lines Rework the whole dbcontext and transaction framework. SA already handles nested transactions so we don't have to worry about them. However, we do have the weird situation where some transactions are tied to MailList .Lock()/.Unlock()/.Save() and some are tied to non-mlist actions. So now we use an @txn decorator to put methods in a session transaction, but then we also hook into the above MailList methods as possibly sub-transactions. We use a weakref subclass to manage the MailList interface, with a dictionary mapping MailList fqdn_listnames against transactions. The weakrefs come in by giving us a callback when a MailList gets derefed such that we're guaranteed to rollback any outstanding transaction. Also, we have one global DBContext instance but rather than force the rest of Mailman to deal with context objects, instead we expose API methods on that object into the Mailman.database module, which the rest of the code will use. Such methods must be prepended with 'api_' to get exposed this way. bin/rmlist now works with the SA-backend. I refactored the code here so that other code (namely, the test suite) can more easily and consistently remove a mailing list. This isn't the best place for it ultimately, but it's good enough for now. New convenience functions Utils.split_listname(), .fqdn_listname(). Convert testall to use Mailman.initialize.initialize(). Not all tests work, but I'm down to only 8 failures and 7 errors. Also, do a better job of recovering from failures in setUp(). MailList.__new__() now takes keyword arguments. ................ r8117 | bwarsaw | 2006-12-11 22:58:06 -0500 (Mon, 11 Dec 2006) | 7 lines Unit test repairs; even though the unit tests are still pretty fragile, everything now passes with the SQLAlchemy storage of list data. Added missing 'personalize' column. Converted mailmanctl and qrunner to initialize() interface. Fixed _cookie_path() to not fail if SCRIPT_NAME is not in the environment. ................ r8118 | bwarsaw | 2006-12-27 18:45:41 -0500 (Wed, 27 Dec 2006) | 21 lines Utils.list_names(): Use a database query to get all the list names. dbcontext.py: Added api_get_list_names() to support Utils.list_names(). listdata.py: Added two additional MailList attributes which need to be stored in the database. The first is 'admin_member_chunksize' which isn't modifiable from the web. The second is 'password' which holds the list's password. HTMLFormatObject: item strings can now be unicodes. bin/list_lists.py: Must call initialize() to get the database properly initialized, not just config.load(). This will be a common theme. SecurityManager.py: - Remove md5 and crypt support - Added mailman.debug logger, though it will be only used during debugging. - The 'secret' can be a unicode now. - A few coding style updates; repr() instead of backticks, 'key in dict' instead of 'dict.has_key(key)' ................ r8119 | bwarsaw | 2006-12-27 19:13:09 -0500 (Wed, 27 Dec 2006) | 2 lines genaliases.py: config.load() -> initialize() ................ r8120 | bwarsaw | 2006-12-27 19:17:26 -0500 (Wed, 27 Dec 2006) | 9 lines Blocked revisions 8113 via svnmerge ........ r8113 | bwarsaw | 2006-12-05 23:54:30 -0500 (Tue, 05 Dec 2006) | 3 lines Initialized merge tracking via "svnmerge" with revisions "1-8112" from https://mailman.svn.sourceforge.net/svnroot/mailman/branches/tmp-sqlalchemy-branch ........ ................ r8121 | bwarsaw | 2006-12-28 23:34:52 -0500 (Thu, 28 Dec 2006) | 20 lines Remove SIGTERM handling from all the CGI scripts. This messes with HTTPRunner because when you issue "mailmanctl stop" after the signal handler has been installed, the process will get a SIGTERM, the signal handler will run, and the process will exit with a normal zero code. This will cause mailmanctl to try to restart the HTTPRunner. I don't think we need that stuff at all when running under wsgi with a SQLAlchemy backend. If mailmanctl kills the HTTPRunner in the middle of the process, I believe (but have not tested) that the transaction should get properly rolled back at process exit. We need to make sure about this, and also we need to test the signal handling functionality under traditional CGI environment (if we even still want to support that). Also, make sure that we don't try to initialize the loggers twice in qrunner. This was the cause of all the double entries in logs/qrunner. Fix a coding style nit in mailmanctl.py. De-DOS-ify line endings in loginit.py. ................
* - Convert all logging to Python's standard logging module. Get rid of allbwarsaw2006-04-171-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* FSF office has moved. chdcking in for MAIN branch.tkikuchi2005-08-271-1/+1
|
* cosmeticbwarsaw2003-04-061-2/+0
|
* main(): Sanity check the language cgi variable.bwarsaw2003-01-271-6/+8
|
* process_form(): When getting the member's full name out of the webbwarsaw2002-09-171-2/+2
| | | | | form, we need to convert it to a unicode string using the charset of the language of the page.
* QuoteHyperChars() -> websafe()bwarsaw2002-05-221-1/+1
| | | | | Also, use Utils.websafe() consistently throughout, instead of the inconsistent calls to cgi.escape().
* GetAdminEmail() eradication campaign.bwarsaw2002-03-261-1/+1
| | | | | process_form(): Make the notification email appear to come from the -bounces address.
* process_form(): i18n fixes. The privacy alert message should be sentbwarsaw2002-02-281-6/+13
| | | | | | to the user in his/her own language, but as this may be different than the list's preferred language, we have to wrap the message creation in a try/finally which sets and restores the list's language.
* process_form(): Handle MembershipIsBanned exceptions.bwarsaw2002-01-061-2/+6
|
* Forward port security patch from Mailman 2.0.8:bwarsaw2001-11-301-1/+3
| | | | | | | | | | Fixes to prevent cross-site scripting exploits. See http://www.cert.org/advisories/CA-2000-02.html Reported by zeno@cgisecurity.com Fix is to cgi.escape() any strings regurgitated from the url back to the browser in the html response.
* process_form(): Lots of cleaning up of the code. Also, make this pagebwarsaw2001-10-121-88/+121
| | | | | | | | | | | | | | | | | | more bulletproof against membership mining for private rosters. If rosters are private, then we'll just put up a fairly generic acknowledgement that's the same regardless of what kind of approval is necessary, or whether the email address is already subscribed or not. Thus no information about private rosters can leak. Note also that if a subscription request comes in for an already subscribed address (using private rosters of course), then we send an alert to the address to let them know that somebody was trying to re-subscribe their address or mine the membership. I also rewrote a bunch of the results strings (sorry translators!) remote_addr(): Remove this. We can do it more cleanly inlined.
* Convert lots of split-line strings to triple-quoted strings. Yes,bwarsaw2001-08-171-21/+18
| | | | | | | this is ugly, but it makes the job much easier for translators of certain languages. Also say "list moderator" instead of "list administrator".
* process_form(): Since this no longer gets called from the "editbwarsaw2001-08-021-41/+0
| | | | | | | | options" button on the listinfo page, it doesn't need to deal with the UserOptions form key, nor does it need to do the hackishly disgusting call_script() trick to get options.py invoked. call_script(): Removed.
* process_form(): Use UserDesc helper class.bwarsaw2001-07-291-9/+2
|
* main(): Simpler idiom for getting the 'language' value out of thebwarsaw2001-07-201-8/+12
| | | | | | | | form, and defaulting to mlist.preferred_language. process_form(): Suck the fullname value out of the form, defaulting to the empty string. Call AddMember() with the new and improved interface.
* A revamp to use the new membership API. Specifically,bwarsaw2001-07-191-3/+3
| | | | process_form(): IsMember()/FindUser() -> isMember();
* Better syslog() calling conventions. Also, don't mark syslog messagesbwarsaw2001-06-271-3/+2
| | | | as translatable.
* print_results(): Toggle off the output of <head><body> tags by settingbwarsaw2001-06-251-0/+5
| | | | | | doc.suppress_head to 1. This is because the output generated from this function comes largely from the subscribe.html template, which includes those tags.
* main(), process_form(), print_results(): We don't need to pass thebwarsaw2001-05-311-5/+5
| | | | | document background color as an argument anymore. Other colors are no longer hardcoded, but taken from mm_cfg.
* Be more paranoid about abnormal shutdown conditions, specifically:bwarsaw2001-05-031-2/+23
| | | | | | | | | | | | | | | | | | | main(): When the user hits the stop button on their browser during a long running operation, Apache 1.3/mod_cgi will eventually catch a SIGPIPE when output is written to the client. It then turns around and SIGTERMs the cgi process, waits three seconds, then SIGKILLs the cgi process. This patch fixes the stale lock file that can result under this situation. Since Python by default doesn't catch SIGTERM, and SIGKILL is uncatchable, either signal would cause the cgi process to exit without raising an exception, giving no chance for the script to clean up after itself. We now open the MailList object in two phases: first, open it unlocked, then lock it and install a SIGTERM handler. The SIGTERM handler unlocks the list and exits, aborting any changes that may have taken place. This is the safest way to ensure that stale locks won't be left around causing other hits on the list to become wedged for a long time.
* main(): Typo fix by Juan Carlos.bwarsaw2001-03-231-1/+1
|
* process_form(): In the MMNeedApproval exception clause, we need to getbwarsaw2001-03-011-0/+3
| | | | | the local variables interpolated into the exception message. Easiest way to do that is to pass it through _().
* More i18n changes.bwarsaw2001-02-281-82/+88
| | | | | | | | | | | | | | | | | | | | | | | De-string-module-ification and some Python 2.0-isms. Fix some _() wrappings to use local variables. At global module scope, set the language to the server's default, until we know which mailing list this request is being made on. main(): Set the document's language to the server's default, until we know which mailing list this request is being made on. Then, once we know the list, set the system and document languages to the list's preferred, until we know the user making the request. (get rid of os.environ['LANG'] settings) process_form(): NEW SUPPORT -- if the user has subscribed without filling in either the password or the confirmed password, Mailman will automatically assign a password for them. If either field is filled but not both, and error message is still displayed. PrintResults() -> print_results()
* jcrey's latest round of I18N changes.bwarsaw2000-12-261-5/+17
|
* First round integration of Juan Carlos's translatable string markings.bwarsaw2000-12-071-28/+28
|
* Fixes for a minor local security hole. Some of the CGI scripts couldbwarsaw2000-09-291-11/+3
| | | | | | | | | | | bomb with tracebacks if PATH_INFO environment variable wasn't defined. Fixed this by making them all use Utils.GetPathPieces() and "doing something sensible" when that returned a false value. Also, edithtml is now hidden behind a login screen, so there's no need to enter the list password to edit the html. You can't even get to the list of files to edit unless you've admin authenticated. Closes SF bug #114091, Jitterbug PR# 24.
* process_form(): Fix for SF bug #111306, results in triplicate when notbwarsaw2000-09-081-3/+1
| | | | supplying a password. Given by Thomas Wouters.
* Applying the patches from SF Bug #109217 that are not specific tobwarsaw2000-07-241-4/+7
| | | | | | | chuqui's site. Specifically, process_form(): slight rewrite of the MMSubscribeNeedsConfirmation text.
* main(): syslog() call needs log file first argument.bwarsaw2000-06-281-1/+1
|
* Convert all uses of sys.stderr.write() and mlist.LogMsg() to the newbwarsaw2000-06-021-3/+4
| | | | syslog() interface.
* process_form(): MMListNotReady => MMListErrorbwarsaw2000-04-041-1/+1
|
* Some meager consistency in handling errors when trying to open thebwarsaw2000-04-041-3/+4
| | | | | | | | | | | | | | mailing list. In all cases, catch the base exception class MMListError, and output HTML indicating the specified list doesn't exist. A more detail message gets printed to logs/error (the str() of the actual exception details). Also: admin.py - Don't catch MMBadConfigError around mlist.parse_matching_header_opt() since this method doesn't ever raise that exception. Actually, that exception isn't raised anywhere in Mailman, so it's been removed.
* Update the copyright lines to include the years 1999 & 2000.bwarsaw2000-03-211-3/+1
|
* process_form(): In regard to the previous patch, the default if thebwarsaw1999-12-021-1/+1
| | | | form has no digest key, is to use the list's default value.
* process_form(): it is possible that the form doesn't have a 'digest'bwarsaw1999-11-301-0/+2
| | | | | key, if the admin has mucked with the listinfo page. Default digest mode to 0 in that case.
* call_script(): Be sure to explicitly flush stdout and stderr since thebwarsaw1999-11-261-0/+2
| | | | | os._exit() appears to skip this, which will cause premature script termination errors.
* Some general cleanup of imports, globals (zapped 'em), and a few otherbwarsaw1999-11-111-83/+90
| | | | | | programming constructs. Could still use a lot more work. Make sure that lists are saved and unlocked when exiting.
* A few changes to the text displayed when approval is needed (includingbwarsaw1999-11-101-10/+11
| | | | one typo).
* Minor reformattingbwarsaw1999-01-081-4/+4
|
* Don't use eval() to turn a string into an int, use int() -- it's safer.bwarsaw1998-12-291-1/+5
|
* added a list.Save() after a successful subscription because the corecotton1998-11-211-2/+1
| | | | | MailList object no longer takes care of this. scott
* Made the script not crash when called without a listname in thecotton1998-10-281-1/+5
| | | | | | | url. when the url doesn't append anything after the /subscribe, there is not PATH_INFO defined, throwing a KeyError. Now the cgi returns an error page indicating that the url is missing a listname. scott