diff options
Diffstat (limited to 'Mailman/rules/docs/no-subject.txt')
| -rw-r--r-- | Mailman/rules/docs/no-subject.txt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Mailman/rules/docs/no-subject.txt b/Mailman/rules/docs/no-subject.txt new file mode 100644 index 000000000..3627ac03f --- /dev/null +++ b/Mailman/rules/docs/no-subject.txt @@ -0,0 +1,34 @@ +No Subject header +================= + +This rule matches if the message has no Subject header, or if the header is +the empty string when stripped. + + >>> from Mailman.configuration import config + >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> rule = config.rules['no-subject'] + >>> rule.name + 'no-subject' + +A message with a non-empty subject does not match the rule. + + >>> msg = message_from_string(u"""\ + ... From: aperson@example.org + ... To: _xtest@example.com + ... Subject: A posted message + ... + ... """) + >>> rule.check(mlist, msg, {}) + False + +Delete the Subject header and the rule matches. + + >>> del msg['subject'] + >>> rule.check(mlist, msg, {}) + True + +Even a Subject header with only whitespace still matches the rule. + + >>> msg['Subject'] = u' ' + >>> rule.check(mlist, msg, {}) + True |
