diff options
| author | Barry Warsaw | 2009-03-03 10:15:42 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2009-03-03 10:15:42 -0500 |
| commit | 542a15b5f973565ecca533c9783f44a8bc37a810 (patch) | |
| tree | 904c59465d913a4f80e63cba8f1ec8982509f3ee /src | |
| parent | f3ee1ed7d9198d79f7feaf6fb3bb5b6e5ae4bd38 (diff) | |
| download | mailman-542a15b5f973565ecca533c9783f44a8bc37a810.tar.gz mailman-542a15b5f973565ecca533c9783f44a8bc37a810.tar.zst mailman-542a15b5f973565ecca533c9783f44a8bc37a810.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/database/mailinglist.py | 5 | ||||
| -rw-r--r-- | src/mailman/database/mailman.sql | 7 | ||||
| -rw-r--r-- | src/mailman/interfaces/mailinglist.py | 29 | ||||
| -rw-r--r-- | src/mailman/pipeline/cook_headers.py | 7 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/cook-headers.txt | 37 | ||||
| -rw-r--r-- | src/mailman/styles/default.py | 9 |
6 files changed, 73 insertions, 21 deletions
diff --git a/src/mailman/database/mailinglist.py b/src/mailman/database/mailinglist.py index 22de044e3..b8cf3e01c 100644 --- a/src/mailman/database/mailinglist.py +++ b/src/mailman/database/mailinglist.py @@ -61,6 +61,9 @@ class MailingList(Model): # List identity list_name = Unicode() host_name = Unicode() + list_id = Unicode() + include_list_post_header = Bool() + include_rfc2369_headers = Bool() # Attributes not directly modifiable via the web u/i created_at = DateTime() admin_member_chunksize = Int() @@ -130,8 +133,6 @@ class MailingList(Model): goodbye_msg = Unicode() header_matches = Pickle() hold_these_nonmembers = Pickle() - include_list_post_header = Bool() - include_rfc2369_headers = Bool() info = Unicode() linked_newsgroup = Unicode() max_days_to_hold = Int() diff --git a/src/mailman/database/mailman.sql b/src/mailman/database/mailman.sql index 6f73c3974..fa772416f 100644 --- a/src/mailman/database/mailman.sql +++ b/src/mailman/database/mailman.sql @@ -74,8 +74,13 @@ CREATE TABLE language ( ); CREATE TABLE mailinglist ( id INTEGER NOT NULL, + -- List identity list_name TEXT, host_name TEXT, + list_id TEXT, + include_list_post_header BOOLEAN, + include_rfc2369_headers BOOLEAN, + -- Attributes not directly modifiable via the web u/i created_at TIMESTAMP, admin_member_chunksize INTEGER, next_request_id INTEGER, @@ -136,8 +141,6 @@ CREATE TABLE mailinglist ( goodbye_msg TEXT, header_matches BLOB, hold_these_nonmembers BLOB, - include_list_post_header BOOLEAN, - include_rfc2369_headers BOOLEAN, info TEXT, linked_newsgroup TEXT, max_days_to_hold INTEGER, diff --git a/src/mailman/interfaces/mailinglist.py b/src/mailman/interfaces/mailinglist.py index 1c1cbc869..e71a47d61 100644 --- a/src/mailman/interfaces/mailinglist.py +++ b/src/mailman/interfaces/mailinglist.py @@ -66,6 +66,8 @@ class DigestFrequency(Enum): class IMailingList(Interface): """A mailing list.""" + # List identity + list_name = Attribute( """The read-only short name of the mailing list. Note that where a Mailman installation supports multiple domains, this short name may @@ -75,13 +77,6 @@ class IMailingList(Interface): posted to mylist@example.com, then the list_name is 'mylist'. """) - real_name = Attribute( - """The short human-readable descriptive name for the mailing list. By - default, this is the capitalized `list_name`, but it can be changed to - anything. This is used in locations such as the message footers and - Subject prefix. - """) - host_name = Attribute( """The read-only domain name 'hosting' this mailing list. This is always the domain name part of the posting email address, and it may @@ -97,6 +92,26 @@ class IMailingList(Interface): always comprised of the list_name + '@' + host_name. """) + real_name = Attribute( + """The short human-readable descriptive name for the mailing list. By + default, this is the capitalized `list_name`, but it can be changed to + anything. This is used in locations such as the message footers and + Subject prefix. + """) + + list_id = Attribute( + """The RFC 2919 List-ID header value.""") + + include_list_post_header = Attribute( + """Flag specifying whether to include the RFC 2369 List-Post header. + This is usually set to True, except for announce-only lists.""") + + include_rfc2369_headers = Attribute( + """Flag specifying whether to include any RFC 2369 header, including + the RFC 2919 List-ID header.""") + + # Contact addresses + posting_address = Attribute( """The address to which messages are posted for copying to the full list membership, where 'full' of course means those members for which diff --git a/src/mailman/pipeline/cook_headers.py b/src/mailman/pipeline/cook_headers.py index 4d3e12eb1..3c67d0193 100644 --- a/src/mailman/pipeline/cook_headers.py +++ b/src/mailman/pipeline/cook_headers.py @@ -179,17 +179,16 @@ def process(mlist, msg, msgdata): if msgdata.get('_nolist') or not mlist.include_rfc2369_headers: return # This will act like an email address for purposes of formataddr() - listid = '{0}.{1}'.format(mlist.list_name, mlist.host_name) cset = mlist.preferred_language.charset if mlist.description: # Don't wrap the header since here we just want to get it properly RFC # 2047 encoded. i18ndesc = uheader(mlist, mlist.description, 'List-Id', maxlinelen=998) - listid_h = formataddr((str(i18ndesc), listid)) + listid_h = formataddr((str(i18ndesc), mlist.list_id)) else: # without desc we need to ensure the MUST brackets - listid_h = '<{0}>'.format(listid) - # We always add a List-ID: header. + listid_h = '<{0}>'.format(mlist.list_id) + # No other agent should add a List-ID header except Mailman. del msg['list-id'] msg['List-Id'] = listid_h # For internally crafted messages, we also add a (nonstandard), diff --git a/src/mailman/pipeline/docs/cook-headers.txt b/src/mailman/pipeline/docs/cook-headers.txt index edbaaa133..ae276a79a 100644 --- a/src/mailman/pipeline/docs/cook-headers.txt +++ b/src/mailman/pipeline/docs/cook-headers.txt @@ -7,8 +7,7 @@ transformations. Some headers get added, others get changed. Some of these changes depend on mailing list settings and others depend on how the message is getting sent through the system. We'll take things one-by-one. - >>> from mailman.pipeline.cook_headers import process - >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> mlist = create_list(u'_xtest@example.com') >>> mlist.subject_prefix = u'' >>> mlist.include_list_post_header = False >>> mlist.archive = True @@ -26,6 +25,8 @@ will place the sender in the message metadata for safe keeping. ... A message of great import. ... """) >>> msgdata = {} + + >>> from mailman.pipeline.cook_headers import process >>> process(mlist, msg, msgdata) >>> msgdata['original_sender'] u'aperson@example.com' @@ -219,6 +220,38 @@ header. <mailto:_xtest-leave@example.com> ---end--- +There are some circumstances when the list administrator wants to explicitly +set the List-ID header. + + >>> from mailman.domain import Domain + >>> domain = Domain(u'mail.example.net') + >>> config.domains[domain.email_host] = domain + >>> mlist.host_name = u'mail.example.net' + + >>> process(mlist, msg, {}) + >>> print msg['list-id'] + My test mailing list <_xtest.example.com> + + >>> mlist.list_id = u'_xtest.mail.example.net' + >>> process(mlist, msg, {}) + >>> print msg['list-id'] + My test mailing list <_xtest.mail.example.net> + + >>> mlist.host_name = u'example.com' + >>> mlist.list_id = u'_xtest.example.com' + +Any existing List-ID headers are removed from the original message. + + >>> msg = message_from_string("""\ + ... From: aperson@example.com + ... List-ID: <123.456.789> + ... + ... """) + + >>> process(mlist, msg, {}) + >>> sorted(msg.get_all('list-id')) + [u'My test mailing list <_xtest.example.com>'] + Administrative messages crafted by Mailman will have a reduced set of headers. >>> msg = message_from_string("""\ diff --git a/src/mailman/styles/default.py b/src/mailman/styles/default.py index ec8d8c776..5bc19e85a 100644 --- a/src/mailman/styles/default.py +++ b/src/mailman/styles/default.py @@ -52,12 +52,15 @@ class DefaultStyle: """See `IStyle`.""" # For cut-n-paste convenience. mlist = mailing_list + # List identity. + mlist.real_name = mlist.list_name.capitalize() + mlist.list_id = u'{0.list_name}.{0.host_name}'.format(mlist) + mlist.include_rfc2369_headers = True + mlist.include_list_post_header = True # Most of these were ripped from the old MailList.InitVars() method. mlist.volume = 1 mlist.post_id = 1 mlist.new_member_options = 256 - # This stuff is configurable - mlist.real_name = mlist.list_name.capitalize() mlist.respond_to_post_requests = True mlist.advertised = True mlist.max_num_recipients = 10 @@ -92,8 +95,6 @@ from: .*@uplinkpro.com mlist.admin_member_chunksize = 30 mlist.administrivia = True mlist.preferred_language = 'en' - mlist.include_rfc2369_headers = True - mlist.include_list_post_header = True mlist.collapse_alternatives = True # Digest related variables mlist.digestable = True |
