diff options
| author | Barry Warsaw | 2007-12-29 19:53:23 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2007-12-29 19:53:23 -0500 |
| commit | 86f00a6cec71753952d1290bdadd836fdba5fdc1 (patch) | |
| tree | 94bd4167060de21e706fc6dec1848092febaa57a /Mailman/docs | |
| parent | 68cce110887cc9fc46fd4c7798f3b8d893f1038f (diff) | |
| download | mailman-86f00a6cec71753952d1290bdadd836fdba5fdc1.tar.gz mailman-86f00a6cec71753952d1290bdadd836fdba5fdc1.tar.zst mailman-86f00a6cec71753952d1290bdadd836fdba5fdc1.zip | |
Port the maximum message size check to a rule. Add doctest.
Rename the implicit.txt doctest.
specialized_message_from_string(): Mimic the way the text->message parser will
include the size of the original text as an attribute on the message object.
The maximum message size rule will use this information.
Diffstat (limited to 'Mailman/docs')
| -rw-r--r-- | Mailman/docs/hold.txt | 22 | ||||
| -rw-r--r-- | Mailman/docs/implicit-dest.txt (renamed from Mailman/docs/implicit.txt) | 2 | ||||
| -rw-r--r-- | Mailman/docs/max-size.txt | 41 |
3 files changed, 42 insertions, 23 deletions
diff --git a/Mailman/docs/hold.txt b/Mailman/docs/hold.txt index ed3fabdf0..16948331f 100644 --- a/Mailman/docs/hold.txt +++ b/Mailman/docs/hold.txt @@ -96,28 +96,6 @@ Just a bit of clean up. >>> mlist.bounce_matching_headers = None -Message size ------------- - -Mailman can hold messages that are bigger than a given size. 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.max_message_size = 1 - >>> one_line = 'x' * 79 - >>> big_body = '\n'.join([one_line] * 15) - >>> msg = message_from_string("""\ - ... From: aperson@example.com - ... To: _xtest@example.com - ... - ... """ + big_body) - >>> process(mlist, msg, {}) - Traceback (most recent call last): - ... - MessageTooBig - >>> clear() - - X Hold Notifications X ------------------ X diff --git a/Mailman/docs/implicit.txt b/Mailman/docs/implicit-dest.txt index 967ddc8c7..b6fed2769 100644 --- a/Mailman/docs/implicit.txt +++ b/Mailman/docs/implicit-dest.txt @@ -11,7 +11,7 @@ not explicitly mentioned in the set of message recipients. >>> rule.name 'implicit-dest' -Mailman will hold messages that have implicit destination, meaning that the +This rule matches messages that have implicit destination, meaning that the mailing list's posting address isn't included in the explicit recipients. >>> mlist.require_explicit_destination = True diff --git a/Mailman/docs/max-size.txt b/Mailman/docs/max-size.txt new file mode 100644 index 000000000..b477ecd2b --- /dev/null +++ b/Mailman/docs/max-size.txt @@ -0,0 +1,41 @@ +Message size +============ + +The 'message-size' rule matches when the posted message is bigger than a +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). + + >>> from Mailman.configuration import config + >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> from Mailman.app.rules import find_rule + >>> rule = find_rule('max-size') + >>> rule.name + 'max-size' + +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) + >>> msg = message_from_string(u"""\ + ... From: aperson@example.com + ... To: _xtest@example.com + ... + ... """ + big_body) + >>> rule.check(mlist, msg, {}) + True + +Setting the maximum message size to zero means no size check is performed. + + >>> mlist.max_message_size = 0 + >>> rule.check(mlist, msg, {}) + False + +Of course, if the maximum size is larger than the message's size, then it's +still okay. + + >>> mlist.max_message_size = msg.original_size/1024.0 + 1 + >>> rule.check(mlist, msg, {}) + False |
