diff options
Diffstat (limited to 'src/mailman/rules')
| -rw-r--r-- | src/mailman/rules/docs/administrivia.txt | 5 | ||||
| -rw-r--r-- | src/mailman/rules/docs/approve.txt | 23 | ||||
| -rw-r--r-- | src/mailman/rules/docs/emergency.txt | 3 | ||||
| -rw-r--r-- | src/mailman/rules/docs/header-matching.txt | 5 | ||||
| -rw-r--r-- | src/mailman/rules/docs/implicit-dest.txt | 17 | ||||
| -rw-r--r-- | src/mailman/rules/docs/loop.txt | 5 | ||||
| -rw-r--r-- | src/mailman/rules/docs/max-size.txt | 7 | ||||
| -rw-r--r-- | src/mailman/rules/docs/moderation.txt | 7 | ||||
| -rw-r--r-- | src/mailman/rules/docs/news-moderation.txt | 3 | ||||
| -rw-r--r-- | src/mailman/rules/docs/no-subject.txt | 5 | ||||
| -rw-r--r-- | src/mailman/rules/docs/recipients.txt | 3 | ||||
| -rw-r--r-- | src/mailman/rules/docs/rules.txt | 7 | ||||
| -rw-r--r-- | src/mailman/rules/docs/suspicious.txt | 5 |
13 files changed, 54 insertions, 41 deletions
diff --git a/src/mailman/rules/docs/administrivia.txt b/src/mailman/rules/docs/administrivia.txt index dba882775..f43a31834 100644 --- a/src/mailman/rules/docs/administrivia.txt +++ b/src/mailman/rules/docs/administrivia.txt @@ -1,3 +1,4 @@ +============= Administrivia ============= @@ -6,7 +7,7 @@ commands in the Subject header or first few lines of the payload. This is used to catch messages posted to the list which should have been sent to the -request robot address. - >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> mlist.administrivia = True >>> rule = config.rules['administrivia'] >>> print rule.name @@ -72,7 +73,7 @@ We don't show all the other possible email commands, but you get the idea. Non-administrivia ------------------ +================= Of course, messages that don't contain administrivia, don't match the rule. diff --git a/src/mailman/rules/docs/approve.txt b/src/mailman/rules/docs/approve.txt index dda531a4c..8ae23b8f3 100644 --- a/src/mailman/rules/docs/approve.txt +++ b/src/mailman/rules/docs/approve.txt @@ -1,3 +1,4 @@ +===================== Pre-approved postings ===================== @@ -13,8 +14,8 @@ approval queue. This has several use cases: In order to support this, a mailing list can be given a 'moderator password' which is shared among all the administrators. - >>> mlist = config.db.list_manager.create(u'_xtest@example.com') - >>> mlist.moderator_password = u'abcxyz' + >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> mlist.moderator_password = 'abcxyz' The 'approved' rule determines whether the message contains the proper approval or not. @@ -25,7 +26,7 @@ approval or not. No approval ------------ +=========== If the message has no Approve or Approved header, then the rule does not match. @@ -42,14 +43,14 @@ If the message has an Approve or Approved header with a value that does not match the moderator password, then the rule does not match. However, the header is still removed. - >>> msg['Approve'] = u'12345' + >>> msg['Approve'] = '12345' >>> rule.check(mlist, msg, {}) False >>> print msg['approve'] None >>> del msg['approve'] - >>> msg['Approved'] = u'12345' + >>> msg['Approved'] = '12345' >>> rule.check(mlist, msg, {}) False >>> print msg['approved'] @@ -59,12 +60,12 @@ header is still removed. Using an approval header ------------------------- +======================== If the moderator password is given in an Approve header, then the rule matches, and the Approve header is stripped. - >>> msg['Approve'] = u'abcxyz' + >>> msg['Approve'] = 'abcxyz' >>> rule.check(mlist, msg, {}) True >>> print msg['approve'] @@ -72,7 +73,7 @@ matches, and the Approve header is stripped. Similarly, for the Approved header. - >>> msg['Approved'] = u'abcxyz' + >>> msg['Approved'] = 'abcxyz' >>> rule.check(mlist, msg, {}) True >>> print msg['approved'] @@ -80,7 +81,7 @@ Similarly, for the Approved header. Using a pseudo-header ---------------------- +===================== Different mail user agents have varying degrees to which they support custom headers like Approve and Approved. For this reason, Mailman also supports @@ -171,7 +172,7 @@ Similarly for the Approved header. MIME multipart support ----------------------- +====================== Mailman searches for the pseudo-header as the first non-whitespace line in the first text/plain message part of the message. This allows the feature to be @@ -355,7 +356,7 @@ And the pseudo-header is removed. Stripping text/html parts -------------------------- +========================= Because some mail readers will include both a text/plain part and a text/html alternative, the 'approved' rule has to search the alternatives and strip diff --git a/src/mailman/rules/docs/emergency.txt b/src/mailman/rules/docs/emergency.txt index 9d80fdb40..2c56d967b 100644 --- a/src/mailman/rules/docs/emergency.txt +++ b/src/mailman/rules/docs/emergency.txt @@ -1,3 +1,4 @@ +========= Emergency ========= @@ -5,7 +6,7 @@ When the mailing list has its emergency flag set, all messages posted to the list are held for moderator approval. >>> from mailman.app.lifecycle import create_list - >>> mlist = create_list(u'_xtest@example.com') + >>> mlist = create_list('_xtest@example.com') >>> msg = message_from_string("""\ ... From: aperson@example.com ... To: _xtest@example.com diff --git a/src/mailman/rules/docs/header-matching.txt b/src/mailman/rules/docs/header-matching.txt index 417000d67..9956832ea 100644 --- a/src/mailman/rules/docs/header-matching.txt +++ b/src/mailman/rules/docs/header-matching.txt @@ -1,3 +1,4 @@ +=============== Header matching =============== @@ -6,7 +7,7 @@ processing. There is a set of site-wide default header matches specified in the configuration file under the [spam.headers] section. >>> from mailman.app.lifecycle import create_list - >>> mlist = create_list(u'_xtest@example.com') + >>> mlist = create_list('_xtest@example.com') Because the default [spam.headers] section is empty, we'll just extend the current header matching chain with a pattern that matches 4 or more stars, @@ -94,7 +95,7 @@ Flush out the extended header matching rules. List-specific header matching ------------------------------ +============================= Each mailing list can also be configured with a set of header matching regular expression rules. These are used to impose list-specific header filtering diff --git a/src/mailman/rules/docs/implicit-dest.txt b/src/mailman/rules/docs/implicit-dest.txt index 8666c1f5c..04e93615e 100644 --- a/src/mailman/rules/docs/implicit-dest.txt +++ b/src/mailman/rules/docs/implicit-dest.txt @@ -1,10 +1,11 @@ +==================== Implicit destination ==================== The 'implicit-dest' rule matches when the mailing list's posting address is not explicitly mentioned in the set of message recipients. - >>> mlist = create_list(u'_xtest@example.com') + >>> mlist = create_list('_xtest@example.com') >>> rule = config.rules['implicit-dest'] >>> print rule.name implicit-dest @@ -56,7 +57,7 @@ then the rule will not match. >>> rule.check(mlist, msg, {}) True - >>> alias_set.add(u'myfriend@example.com') + >>> alias_set.add('myfriend@example.com') >>> rule.check(mlist, msg, {}) False @@ -69,7 +70,7 @@ that Mailman pulled it from the appropriate news group. Additional aliases can be added. - >>> alias_set.add(u'other@example.com') + >>> alias_set.add('other@example.com') >>> del msg['to'] >>> rule.check(mlist, msg, {}) True @@ -80,13 +81,13 @@ Additional aliases can be added. Aliases can be removed. - >>> alias_set.remove(u'other@example.com') + >>> alias_set.remove('other@example.com') >>> rule.check(mlist, msg, {}) True Aliases can also be cleared. - >>> msg['Cc'] = u'myfriend@example.com' + >>> msg['Cc'] = 'myfriend@example.com' >>> rule.check(mlist, msg, {}) False @@ -96,13 +97,13 @@ Aliases can also be cleared. Alias patterns --------------- +============== It's also possible to specify an alias pattern, i.e. a regular expression to match against the recipients. For example, we can say that if there is a recipient in the example.net domain, then the rule does not match. - >>> alias_set.add(u'^.*@example.net') + >>> alias_set.add('^.*@example.net') >>> rule.check(mlist, msg, {}) True @@ -112,7 +113,7 @@ recipient in the example.net domain, then the rule does not match. Bad aliases ------------ +=========== You cannot add an alias that looks like neither a pattern nor an email address. diff --git a/src/mailman/rules/docs/loop.txt b/src/mailman/rules/docs/loop.txt index 61612cd75..5015d3d95 100644 --- a/src/mailman/rules/docs/loop.txt +++ b/src/mailman/rules/docs/loop.txt @@ -1,10 +1,11 @@ +============= Posting loops ============= To avoid a posting loop, Mailman has a rule to check for the existence of an X-BeenThere header with the value of the list's posting address. - >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> rule = config.rules['loop'] >>> print rule.name loop @@ -21,7 +22,7 @@ The header could be missing, in which case the rule does not match. The header could be present, but not match the list's posting address. - >>> msg['X-BeenThere'] = u'not-this-list@example.com' + >>> msg['X-BeenThere'] = 'not-this-list@example.com' >>> rule.check(mlist, msg, {}) False diff --git a/src/mailman/rules/docs/max-size.txt b/src/mailman/rules/docs/max-size.txt index 117691e59..a34c98627 100644 --- a/src/mailman/rules/docs/max-size.txt +++ b/src/mailman/rules/docs/max-size.txt @@ -1,3 +1,4 @@ +============ Message size ============ @@ -6,7 +7,7 @@ specified maximum. Generally this is used to prevent huge attachments from getting posted to the list. This value is calculated in terms of KB (1024 bytes). - >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> rule = config.rules['max-size'] >>> print rule.name max-size @@ -15,8 +16,8 @@ For example, setting the maximum message size to 1 means that any message bigger than that will match the rule. >>> mlist.max_message_size = 1 # 1024 bytes - >>> one_line = u'x' * 79 - >>> big_body = u'\n'.join([one_line] * 15) + >>> one_line = 'x' * 79 + >>> big_body = '\n'.join([one_line] * 15) >>> msg = message_from_string("""\ ... From: aperson@example.com ... To: _xtest@example.com diff --git a/src/mailman/rules/docs/moderation.txt b/src/mailman/rules/docs/moderation.txt index 65be0d7da..c4adcdf53 100644 --- a/src/mailman/rules/docs/moderation.txt +++ b/src/mailman/rules/docs/moderation.txt @@ -1,3 +1,4 @@ +================= Member moderation ================= @@ -6,7 +7,7 @@ postings, then only members with a cleared moderation flag will be able to email the list without having those messages be held for approval. The 'moderation' rule determines whether the message should be moderated or not. - >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> rule = config.rules['moderation'] >>> print rule.name moderation @@ -26,7 +27,7 @@ moderation rule can't match. Let's add the message author as a non-moderated member. >>> user = config.db.user_manager.create_user( - ... u'aperson@example.org', u'Anne Person') + ... 'aperson@example.org', 'Anne Person') >>> address = list(user.addresses)[0] >>> from mailman.interfaces.member import MemberRole >>> member = address.subscribe(mlist, MemberRole.member) @@ -43,7 +44,7 @@ Once the member's moderation flag is set though, the rule matches. Non-members ------------ +=========== There is another, related rule for matching non-members, which simply matches if the sender is /not/ a member of the mailing list. diff --git a/src/mailman/rules/docs/news-moderation.txt b/src/mailman/rules/docs/news-moderation.txt index 2ba6aa065..5658ccfef 100644 --- a/src/mailman/rules/docs/news-moderation.txt +++ b/src/mailman/rules/docs/news-moderation.txt @@ -1,3 +1,4 @@ +==================== Newsgroup moderation ==================== @@ -8,7 +9,7 @@ posted to the newsgroup, and from there, gated to the mailing list. It's a circuitous route, but it works nonetheless by holding all messages posted directly to the mailing list. - >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> rule = config.rules['news-moderation'] >>> print rule.name news-moderation diff --git a/src/mailman/rules/docs/no-subject.txt b/src/mailman/rules/docs/no-subject.txt index 576111cd7..f9b3ece03 100644 --- a/src/mailman/rules/docs/no-subject.txt +++ b/src/mailman/rules/docs/no-subject.txt @@ -1,10 +1,11 @@ +================= No Subject header ================= This rule matches if the message has no Subject header, or if the header is the empty string when stripped. - >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> rule = config.rules['no-subject'] >>> print rule.name no-subject @@ -28,6 +29,6 @@ Delete the Subject header and the rule matches. Even a Subject header with only whitespace still matches the rule. - >>> msg['Subject'] = u' ' + >>> msg['Subject'] = ' ' >>> rule.check(mlist, msg, {}) True diff --git a/src/mailman/rules/docs/recipients.txt b/src/mailman/rules/docs/recipients.txt index 3cd49d501..e8c63b59a 100644 --- a/src/mailman/rules/docs/recipients.txt +++ b/src/mailman/rules/docs/recipients.txt @@ -1,10 +1,11 @@ +============================ Maximum number of recipients ============================ The 'max-recipients' rule matches when there are more than the maximum allowed number of explicit recipients addressed by the message. - >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> rule = config.rules['max-recipients'] >>> print rule.name max-recipients diff --git a/src/mailman/rules/docs/rules.txt b/src/mailman/rules/docs/rules.txt index 095d11466..2836d10a1 100644 --- a/src/mailman/rules/docs/rules.txt +++ b/src/mailman/rules/docs/rules.txt @@ -1,3 +1,4 @@ +===== Rules ===== @@ -7,7 +8,7 @@ links determine what happens when a rule matches. All rules ---------- +========= Rules are maintained in the configuration object as a dictionary mapping rule names to rule objects. @@ -40,13 +41,13 @@ You can get a rule by name. Rule checks ------------ +=========== Individual rules can be checked to see if they match, by running the rule's `check()` method. This returns a boolean indicating whether the rule was matched or not. - >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> msg = message_from_string("""\ ... From: aperson@example.com ... diff --git a/src/mailman/rules/docs/suspicious.txt b/src/mailman/rules/docs/suspicious.txt index 190a34aca..79d3eeea5 100644 --- a/src/mailman/rules/docs/suspicious.txt +++ b/src/mailman/rules/docs/suspicious.txt @@ -1,3 +1,4 @@ +================== Suspicious headers ================== @@ -5,14 +6,14 @@ Suspicious headers are a way for Mailman to hold messages that match a particular regular expression. This mostly historical feature is fairly confusing to users, and the list attribute that controls this is misnamed. - >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> rule = config.rules['suspicious-header'] >>> print rule.name suspicious-header Set the so-called suspicious header configuration variable. - >>> mlist.bounce_matching_headers = u'From: .*person@(blah.)?example.com' + >>> mlist.bounce_matching_headers = 'From: .*person@(blah.)?example.com' >>> msg = message_from_string("""\ ... From: aperson@example.com ... To: _xtest@example.com |
