summaryrefslogtreecommitdiff
path: root/Mailman/GatewayManager.py
Commit message (Collapse)AuthorAgeFilesLines
* It all started by trying to remove MailList.Create() and use the IListManagerBarry Warsaw2007-08-051-39/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | interface to create and delete lists. Mostly that's working now, but I need unit tests for most of the new work contained in this revision. Implemented a rudimentary 'list styles' subsystem, along with interfaces, but no tests yet. Moved all of MailList.InitVars() into a DefaultStyle, which is always available at priority zero. It's used by default if there are no matching styles for a mailing list. Because of the list styles, we can now get rid of (almost) all InitVars() methods. And because of /that/ we can get rid of the mixin clases whose sole purpose was to provide an InitVars() method. Yay for code removal! Mixin modules/classes removed: Autoresponder, GatewayManager, TopicManager. Removed the Mailman/ext crufty extension mechanism. Extensions will now be done using setuptools plugins. Hopefully this will take us everywhere we need to go, but I'll add Mailman.ext back if necessary later. Mailiman.app.create module added to implement a common, higher-level list creation feature. This is used by bin/newlist now, though some of that functionality (namely, ensuring the owners exist in the database, and notifying the owners) should be moved here. The MTA plugins aren't yet integrated into this, but need to be. Mailman.app.plugins module added to generalize setuptools plugin management. Defaults.DEFAULT_REPLY_GOES_TO_LIST now gets initialized with a proper enum. Also, the duplicate DeliveryMode and DeliveryStatus enums are removed from Defaults because they're in Mailman.constants. Added Errors.DuplicateStyleError. Updated Utils.list_exists() to use the new IListManager.get() interface, which has been changed to return None if the list doesn't exist (for consistency) instead of raising an exception. Utils.list_names() also needed to be fixed to use config.db.list_manager. bin/make_instance, bin/newlist, bin/rmlist changed to use parser.error() istead of printing to sys.stderr and sys.exit(1). bin/newlist and bin/rmlist now works with the IListManager interface, so you can create and delete lists from the command line again. The CLI for newlist has been much simplified; it no longer prompts for missing positional arguments. It now uses a more traditional CLI. newlist also accepts zero to many owners, and it ensures that the owners are all in the database. It no longer asks for a list password, because this doesn't make sense any more. bin/withlist has also been fixed to work with the IListManager interface. There are lots of XXXs and FIXMEs that need to be resolved before this can land. Also, we need to test all this stuff before it can land. Configuration.load() is now taught to search in sys.argv[0] for var/etc/mailman.cfg since this is where it is for egg development layouts. Also, VAR_DIR must be abspath'd. Added an __all__ to Mailman.constants, and added an Action enum. The listmanager implementation has to set the mlist.created_at time. There's also a bit of crufty refactoring going on to instantiate the roster objects whenever the list is created or retrieved from the database. Several MailingList column types are now set to our custom TimeDeltaType, which knows how to store a datetime.timedelta. A SQLAlchemny converter type is added to Mailman.database.types. I also fixed a bug in the EnumType implementation.
* Update copyright years.bwarsaw2007-01-191-1/+1
|
* Merged revisions 8113-8121 via svnmerge from bwarsaw2006-12-291-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. ................
* FSF office has moved. chdcking in for MAIN branch.tkikuchi2005-08-271-1/+1
|
* InitVars(): New config variable news_moderation, which is a 3-way flagbwarsaw2002-10-191-3/+6
| | | | | | | | | | | | | | | | | controlling how the mail->news gateway should handle moderation. This supplants MM2.0's SF patch #401270 in a much simpler way. Possible values are: - 0 means we're not gating to a moderated newsgroup - 1 means "open list, moderated group", essentially we just add an Approved header to the gated message, but do nothing else special - 2 means "moderated" which adds an additional hold criteria to the message. Once the message is approved, it gets an Approved header and is gated. Note: this was a top request by the FSF, and essential for python.org. I had a brainstorm about how to make this fairly simple to add so we're thawing the release for this one.
* Allow postings gatewayed to Usenet to inhibit the Subject: fieldbwarsaw2002-07-311-0/+1
| | | | | | | | | 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. InitVars(): New attribute news_prefix_subject_too which controls this feature. Hard code the default.
* Update copyright years.bwarsaw2002-03-161-1/+1
|
* All:bwarsaw2001-07-181-36/+0
| | | | | | | | | | | | | | | | | | | | | | | | GetConfigInfo(): Removed. All admin ui gui elements are moved into components in the Mailman/Gui subdirectory. All membership related attribute access should use the MemberAdaptor API instead, e.g. IsMember() -> isMember() GetUserOption() -> getMemberOption() SetUserOption() -> setMemberOption() Also use ApprovedDeleteMember() instead of DeleteMember(). Deliverer.py: Remove last vestiges of os.environ['LANG'] Digester.py: SetUserDigest(): Removed. This is replaced by OldStyleMemberships's setMemberOption() method when flag == mm_cfg.Digests
* Reformatting.bwarsaw2001-02-281-18/+21
|
* First integration patch for Juan Carlos's translatable string changesbwarsaw2000-12-071-14/+14
|
* GatewayManager.InitVars(): Accepted SF patch #101333, David Champion'sbwarsaw2000-09-191-1/+1
| | | | patch to set the default nntp_host in mm_cfg.py.
* GetConfigInfo(): Reword slightly the two toggles to be morebwarsaw2000-06-231-4/+12
| | | | | understandable. Also, added the volatile _mass_catchup attribute for explicitly catching up a linked newsgroup.
* Update the copyright lines to include the years 1999 & 2000.bwarsaw2000-03-211-1/+1
|
* GetConfigInfo(): Use TEXTFIELDWIDTH for all string input fieldsbwarsaw2000-03-031-2/+7
| | | | (including text areas).
* All the functionality of this class is moved elsewhere (cron/gate_newsbwarsaw1999-11-121-160/+8
| | | | | | for the news->mail gateway and Handlers/ToUsenet for mail->news). This class now contains only the list configuration variables.
* Fixed typo in SendMailToNewsGroup().hmeland1999-07-011-1/+1
|
* PollNewsGroup(): Synthesize unixfrom header ("From ") forbwarsaw1999-04-021-0/+7
| | | | interoperability with Pipermail.
* SendMailToNewsGroup(): The test for whether to short-circuit (and thusbwarsaw1999-03-061-7/+10
| | | | | not post the message to Usenet) is now whether the msg object has an attribute `fromusenet' and this attribute is true.
* GatewayManager.SendMailToNewsGroup(): Disgusting but necessary hack tobwarsaw1999-02-101-0/+17
| | | | | | | | | | | | | | | ensure that the outgoing message has at most only one Content-Transfer-Encoding header. My NNTP server barfs badly (441 error) if there is more than one such header present. Bogosities: I don't know why email from me has about 4 of these headers when gated to news. What happens if these multiples have conflicting values -- right now I just take the first such value. If there is no such header, we don't add one. See also the comments in the code. This whole patch could be suspect, but it was necessary to get message gated to the new python-list@python.org.
* SendMailToNewsGroup(): Slight reconfiguration of error messagesbwarsaw1998-12-301-7/+7
|
* SendMailToNewsGroup(): Don't raise an exception when either thebwarsaw1998-12-301-4/+8
| | | | | | | | linked_newsgroup or nntp_host is empty. Instead log the error to logs/error and just return, otherwise the email doesn't get posted to the list. Removed exception ImproperNNTPConfigError.
* SendMailToNewsGroup(): Small stylistic tweak to put the os.fork() inbwarsaw1998-12-291-2/+2
| | | | line
* PollNewsGroup(): Significantly rewritten to work better with the newbwarsaw1998-12-181-21/+14
| | | | | | | | | | | cron/gate_news script. API to the method has changed, since gate_news calculates the watermark, first, and last, and passes in the NNTP connection object. This method now returns None. Also fixed a bug in the range() calculation that caused every message in the newsgroup to be gated to the list! Fixed a bogus except.
* SendMailToNewsGroup(): Okay, use the same test that's in MailList.pybwarsaw1998-12-171-1/+1
|
* SendMailToNewsGroup(): If the Subject: line does not include abwarsaw1998-12-171-1/+6
| | | | | [Prefix], add one. This test is a little different than the one in MailList.py; we check for [Prefix] in the entire line.
* GetConfigInfo(): Fixed bogus indentationbwarsaw1998-12-171-19/+19
|
* Several changes. WARNING: This is untested since I don't currentlybwarsaw1998-12-101-118/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | have a newsfeed I can post to. Someone please check this (at least it doesn't have syntax errors :-) - Reformatted to standard 4-space indents, and untabified. - Moved common imports (which have already probably been done in the process) to the top of the file. Imports of Message and nntplib are left in place. - QuickEscape is moderately bogus, but at least do it legally (don't compare exception based on string value, base it on object equivalence). - In PollNewsGroup(), we know we want count, first, and last (as returned from con.group()) to be integers. Convert them right after retrieval with int() instead of when used using slower/riskier eval(). - When opening the pipe, craft the command to execute /path/to/python /other/path/to/scripts/post listname nonews using the configure calculated paths in the first two arguments. This is because scripts/post isn't installed with execute bit set. - In SendMailToNewsGroup() we only add a Sender: header if one doesn't already exist. Also, watch for existing Newsgroups: header; if one exists, check to see if our linked_group is already present. Only if not do we append our group. If Newsgroups: doesn't exist at all, add it.
* Convert all module names to their new names.bwarsaw1998-06-191-2/+6
|
* Multi-line headers won't have a colon in every line, so don't assume there ↵viega1998-06-021-2/+2
| | | | will be one.
* Pretty minor bugfixing. Use NewsMessage instead of the mail message soviega1998-06-021-18/+41
| | | | we don't write any unwanted headers, etc.
* Added a mixin that allows for Mail->News and News->Mail gateways. Iviega1998-05-311-0/+119
can't test whether the actual gating both ways works until I get access to an nntpd from list.org (which will be monday at the latest). However, at the very worst, the code doesn't impede mailman's normal operation. The only potential problem I can see w/ all the code I'm checking in is that one could gate from News to Mail, and have the list hold the post for approval and/or bounce the post, and notify the person posting to a newsgroup. That's probably not right. However, that shouldn't be too hard to fix.