summaryrefslogtreecommitdiff
path: root/Mailman/Message.py
Commit message (Collapse)AuthorAgeFilesLines
* Bite the bullet: rename the Mailman package to mailman.Barry Warsaw2008-02-271-310/+0
|
* Tweak copyright years.Barry Warsaw2008-02-071-1/+1
|
* Add three new rules and their associated doctests.Barry Warsaw2007-12-301-1/+4
| | | | | | | | | - A rule that checks to see if the sender is a moderated member. - A rule that checks to see if the sender is a non-member. - A rule that checks to see if the message has no (or an empty) Subject. Give IMembers (and the associated database implementation) an `is_moderated` flag.
* Add .get() to our Message subclass, which ensures that returnedBarry Warsaw2007-12-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | values are unicodes if they come from the base class as a string. Get rid of the 'global id'. Now use just Message-ID. Rename X-List-ID-Hash to X-Message-ID-Hash. Do not take Date header into account when calculating this hash. Because of the above change, the assumption is that there will be no Message-ID collisions. Therefore, get rid of IMessageStore .get_message(), .get_messages_by_message_id() and .get_messages_by_hash(). Instead, it's now .get_message_by_id() and .get_message_by_hash() both of which return the message object or None. Message.hash -> Message.message_id_hash When storing a message in the message store, the final path component has the entire hash, not just the leftover parts after directory prefix splitting. MessageStore.delete_message() deletes the file too. Doctests clean up message store messages though the message store instead of directly off the filesystem.
* More doctest fixes.Barry Warsaw2007-11-081-1/+2
|
* Fix two more doctestsBarry Warsaw2007-11-071-0/+4
|
* Fix two doctests: ack-headers and acknowledgment.Barry Warsaw2007-11-061-0/+6
| | | | | | | | | | | | | | | | | | | This hacks around an apparent bug in the email package where if you parse a unicode message string, you still end up getting 8-bit strings out of the headers, and probably payloads. The hack is to override Mailman.Message.Message.__getitem__() to force the header value returned to a Unicode. It must be ASCII but this is required anyway by RFC 2822. It's not perfect, but it lets us get farther without forcing a detour into fixing the email package. Other changes: - Fix the Address table's references, and also update the subscribe() query. - Fix the Member table's references and add a __init__(). - Fix Roster's get_member() query. - Fix the Enum class's variable_class attribute. - UserManager.create_user() has to use Unicodes for real_name.
* Eradicate mm_cfg.pyBarry Warsaw2007-09-291-2/+2
|
* Reorganize the qrunner infrastructure. First, the package has been renamedBarry Warsaw2007-09-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | 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.
* Work out subscription holding and handling. ApprovedAddMember() isBarry Warsaw2007-09-161-3/+5
| | | | | | gone. Fix up OwnerNotification class. Rewrite subauth.txt and subscribeack.txt for new implementation, especially removing the password notification from the latter. Add lots of tests.
* Repair some test suite regressions.Barry Warsaw2007-08-011-1/+1
|
* Move the pending database into the SQLAlchemy/Elixir layer. The oldBarry Warsaw2007-08-011-22/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* csetstr is not set if lang==None. Use charset as string.tkikuchi2007-03-101-5/+4
|
* Restoreing i18n in 2.2tkikuchi2007-03-011-4/+5
| | | | | | | | - As the default type of string in mailman-2.2 was set to 'unicode', i18n codes became need to be fixed. - Fixed: admin web interface. Other web interfaces needs more verification. - Fixed: non-digest delivery. Stil to go: digest and archive.
* Update copyright years.bwarsaw2007-01-191-1/+1
|
* Fix some buglets with virtual domain support and repair unit tests broken bybwarsaw2006-07-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | this change. More unit tests should be added. misc/sitelist.cfg is removed -- this is an ex-site list. MailList.GetNoReplyEmail() -> MailList.no_reply_address (property) UserNotification._enqueue(), OwnerNotification._enqueue(): when queing the message to the virgin queue, be sure to use the fully qualified (i.e. posting) address for the list. In the MTA modules, be sure to set up the target of the mail commands as the fqdn listname because otherwise we can't find the correct list. This needs some tweaking/testing for Postfix's virtual domain support. MailList.Load() has to grow an optional argument specifying the fqdn listname. The problem is that in some situations, we can't calculate that because we don't know _internal_name, so it has to be passed in. This is mostly the case in the MailList ctor where a Load hasn't happened yet. For backward compatibility though, if it's not passed in, just use mlist.fqdn_listname.
* First crack at real virtual domain support, i.e. mailing lists with the samebwarsaw2006-07-081-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | name in more than one domain. - Totally eradicate MAILMAN_SITE_LIST, and in fact the entire need for a site list. The functions that the site list previously performed are either removed or supported in other ways. For example, instead of forwarding owner bounces to the site list, we now have a SITE_OWNER_ADDRESS which should point to a human, and such bounces are sent there instead. There's also a "no reply" email address that should be set up to go to devnull. For any message that never expects a reply, the sender is set to this address. - Remove the Site.py module. It was an experimental approach to trying to support virtual domains, and we're going to do it so much better now that this module is no longer necessary. Site._makedirs() -> Utils.makedir(). - VIRTUAL_HOST_OVERVIEW is completely removed, since now virtual hosts are always enabled. Virtual domains should be added to mailman.cfg by using the new add_domain() function. add_virtualhost() is gone. If no virtual domains are added explicitly, we add the default one that configure guessed (but we never add that if domains are added explicitly). - Utils.get_domain() -> Utils.get_request_domain() - withlist code cleanup and make sure that we load etc/mailman.cfg - A new base exception called MailmanException is added, from which all exceptions defined in Errors.py ultimately derive. MailmanError is retained and derives from MailmanException. - BadDomainSpecificationError is added. - Remove the -V/--virtual-host-overview option from list_lists and add instead -d/--domain and -f/--full. - bin/update probably works but needs more testing. - bin/newlist and bin/rmlist take fqdn list names, but default to the default domain if @whatever isn't given. newlist's -u/--urlhost and -e/--emailhost options are removed. The domain that the list is being added to must already exist. - Minor code cleanup in Message.py - Bump version to 2.2.0a1 - The Configuration object grows a .domain dictionary which maps email hosts to url hosts. The reverse mapping is supported, but not directly; use Configuration.get_email_host() instead. - Mailman/Cgi/create is converted from mm_cfg to config, and some minor code cleanup is performed. Also, convert to __i18n_templates__ = True. - New MailList APIs: + property .fqdn_listname + GetNoReplyEmail() + Create() API changes and refactoring.
* Fix test_message.py by finishing the wind-through of the configuration objectbwarsaw2006-07-081-9/+9
| | | | | | | | | | | | | | | | 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
* Massive conversion process so that Mailman can be run from a user specifiedbwarsaw2006-07-081-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | configuration file. While the full conversion is not yet complete, everything that seems to be required to run mailmanctl, qrunner, rmlist, and newlist have been updated. Basically, modules should no longer import mm_cfg, but instead they should import Mailman.configuration.config. The latter is an object that's guaranteed to exist, but not guaranteed to be initialized until some top-level script calls config.load(). The latter should be called with the argument to -C/--config which is a new convention the above scripts have been given. In most cases, where mm_cfg.<variable> is used config.<variable> can be used, but the exceptions are where the default value must be available before config.load() is called. Sometimes you can import Mailman.Default and get the variable from there, but other times the code has to be changed to work around this limitation. Take each on a case-by-case basis. Note that the various directories calculated from VAR_PREFIX, EXEC_PREFIX, and PREFIX are now calculated in config.py, not in Defaults.py. This way a configuration file can override the base directories and everything should work correctly. Other changes here include: - mailmanctl, qrunner, and update are switched to optparse and $-strings, and changed to the mmshell architecture - An etc directory has been added to /usr/local/mailman and a mailman.cfg.sample file is installed there. Sites should now edit an etc/mailman.cfg file to do their configurations, although the mm_cfg file is still honored. The formats of the two files are identical. - list_lists is given the -C/--config option - Some coding style fixes in bin/update, but not extensive - Get rid of nested scope hacks in qrunner.py - A start on getting EmailBase tests working (specifically test_message), although not yet complete.
* Remove most uses of the types module, in favor of isinstance checks againstbwarsaw2006-04-171-4/+3
| | | | | | 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.
* Changed email package to 2.5.7. Backed out workaround set_payload() methodmsapiro2006-03-061-12/+1
| | | | from Message.py
* Wrapping set_payload() to encode contents into qp/base64 upon setting.tkikuchi2006-01-291-0/+11
| | | | | | This incorporates Python email patch: http://sourceforge.net/tracker/?func=detail&aid=1409455&group_id=5470&atid=105470 and eventually be backed out if email package is updated.
* Port cleaning changes forward from 2.1-maint branch.bwarsaw2005-12-301-1/+5
|
* Wrap get_filename(). This should eventually be backed out if email packagetkikuchi2005-12-061-0/+7
| | | | is updated.
* back porting from 2.1.6tkikuchi2005-08-281-1/+1
|
* FSF office has moved. chdcking in for MAIN branch.tkikuchi2005-08-271-1/+1
|
* If a message is being auto-responded to, but the subject of it containstwouters2003-03-201-1/+2
| | | | | non-ASCII data, lets not make email.Header.Header barf on it; use 'replace' as the unicode error strategy (this requires email-2.5b1.)
* Handle letters (e.g. as in "b1") in email.__version__bwarsaw2003-03-121-5/+7
|
* OwnerNotification.__init__(): The signature of the OwnerNotificationbwarsaw2002-10-231-1/+21
| | | | | | | | | | | | constructor is changing. We no longer pass the sender in since that's calculated to be the site list's -bounces address to prevent mail loops when a list's owner bounces. Also, factor out the _enqueue() private method from the send() method. OwnerNotifications need to set the `envsender' key on the message's metadata. Problem diagnosed by Peer Heinlein.
* OwnerNotification: New convenience class, derives frombwarsaw2002-10-151-0/+15
| | | | | | | | | UserNotification but provides a different constructor. It calculates the recipients from the list's owners and, if the tomoderators flag is true (the default), includes the list's moderators. The ctor also munges the To header so that it looks like it's being sent to the list's -owner address.
* __setstate__(): This plus email-2.4.3 should fix (most of) Peerbwarsaw2002-10-141-2/+33
| | | | | | | | | | | | | | | | | | Heinlein's recent problems. This patch adds several things to better update pickled Message objects to the latest email package. Specifically, __init__(): Add a version number to Message objects so that we can make __setstate__() more efficient (I don't want to do the next bit of hackery for every single unpickled Message object). __setstate__(): For Message objects older than the current email package version, we'll ensure that the data format is the same. We keep the previous updates and add one that trolls through the message headers, ensuring that if any of the headers are Header instances, that their chunks all have 2nd items as Charset instances, not strings. This is an invariant for email 2.4.3, but older Message instances might not conform.
* get_senders(): Move the list of headers to consult to Defaults.py.inbwarsaw2002-08-061-1/+1
| | | | to aid in debugging.
* __setstate__(): If you had messages in your qfiles directory betweenbwarsaw2002-07-261-1/+11
| | | | | | | | | | | updates from email 2.1 and email 2.2, you're a bit screwed. Message objects grew a _default_type attribute which is *probably* text/plain but that's not guaranteed. Unfortunately at the time __setstate__() is called, we can't know for sure what _default_type ought to be, since it depends on whether this object is contained in a multipart/digest and we have no reference to the container. This is the best we can do.
* UserNotification.send(): If the message doesn't already have abwarsaw2002-05-221-0/+5
| | | | | Precedence: header, add Precedence: bulk since these are typically internally crafted messages destined for a single address.
* get_senders(): Two fixes: first, make sure the unixfrom addition is abwarsaw2002-05-221-4/+4
| | | | | | 2-tuple with an empty realname item; second, we should extract all matching headers with Message.get_all() to make sure we don't miss anything (even though RFC 2822 says those should only appear once).
* send(): Add `reduced_list_headers' so CookHeaders knows not to add thebwarsaw2002-04-081-0/+1
| | | | List-Post: et al headers.
* get_senders(): If there's no envelope, get_unixfrom() will returnbwarsaw2002-04-051-1/+2
| | | | None, which obviously can't be .split(). This is more robust.
* UserNotification.__init__(): If no text argument is given, don't setbwarsaw2002-03-121-4/+2
| | | | | | | | | the character set. The most common reason for this is that the notification message is a multipart/mixed and it makes no sense to give those type of messages a charset. .send(): Set the `nodecorate' key to 1 so that messages that original from the virgin queue don't get headers and footers.
* get_senders(): Application of Jason Mastaler's patch #509386 whichbwarsaw2002-03-071-0/+43
| | | | | | | | | | | | | | | loosens the membership test to check additional headers. I've modified Jason's patch in the following ways: - get_author() -> get_senders() even though I suggested the former. ;) I'd like to eventually deprecate get_sender() so this will be its eventual replacement. - added an optional `headers' argument which defaults to None, meaning the list of headers we agreed on previously. This allows you to pass in the exact headers you want to consult (and their order). - Some implementation details.
* UserNotification.__init__(): If there's no text argument given, butbwarsaw2002-02-281-1/+4
| | | | | | | | | there was a lang argument given, call self.set_charset() instead of doing nothing. Note that when a text argument is given, set_charset() is called implicitly by set_payload(). Otherwise, given lang but no text results in no MIME-Version: header being set.
* __setstate__(): When unpickling Message instances, check to make surebwarsaw2002-02-231-0/+6
| | | | | | | | | | | | | | they have a _charset attribute, adding a default one if not. This should fix a problem I think Dan Mick had, which I believe is caused by a Message object being pickled w/ version 0.96 of the email package, and unpickled by 0.97/1.1 of the email package. Why doesn't this go into email.Message.Message? Because I don't want to clutter its code up with something that should both be transient and assumes that Message is pickled. Mailman seems more responsible for the pickle consistency (if every Python class that grew an attribute had to have such schema migration code, we'd be up sh*ts creek).
* UserNotification.__init__(): Add a `lang' optional argument so thatbwarsaw2002-02-111-3/+10
| | | | | | | charset information can be propagated into the headers, if necessary. Use the new mimelib/email package's Charset and Header classes. Patch by Ben Gertzfield. Requires email 0.97.
* Give Message class an __repr__() since apparently the pretty printerbwarsaw2002-01-171-0/+4
| | | | | module pprint uses repr() instead of str(). This aids in debugging with bin/dumpdb.
* send(): RFC 2822 requires the Date: header, and not all MTAs insertbwarsaw2002-01-111-1/+4
| | | | | | | one if it's missing (most notably qmail). It's easy and correct for us to add a compliant one. SF patch #500670 by Jason Mastaler.
* get_sender(): Minor efficiency.bwarsaw2001-10-151-1/+1
|
* Convert from mimelib to email.bwarsaw2001-10-011-6/+4
| | | | | Also, use cStringIO directly instead of our own hack-around StringIO module.
* get_sender(): Watch out for missing Sender: or From: fields, whichbwarsaw2001-07-061-4/+15
| | | | | | | | | | | cause None to be returned from self.__getitem__(). Keep looking through headers if that happens (this avoids a bug reported by Mentor Cana on messages with no Sender: header and USE_ENVELOPE_SENDER set to true). send(): If the message doesn't have a Message-ID (and it probably won't), craft one. This aids in debugging because the message-id will get logged to logs/smtp.
* UserNotification.__init__(): change the signature so that the textbwarsaw2001-06-281-2/+3
| | | | | argument defaults to None. Only set the payload when the text argument is not None.
* UserNotification.send(): Add optional **_kws which are passed straightbwarsaw2001-05-251-3/+4
| | | | through to the enqueue() method.
* UserNotification.__init__(): Use the blessed way of doing typebwarsaw2001-05-221-1/+1
| | | | comparisons.