summaryrefslogtreecommitdiff
path: root/Mailman/queue
diff options
context:
space:
mode:
authorBarry Warsaw2007-12-29 19:53:23 -0500
committerBarry Warsaw2007-12-29 19:53:23 -0500
commit86f00a6cec71753952d1290bdadd836fdba5fdc1 (patch)
tree94bd4167060de21e706fc6dec1848092febaa57a /Mailman/queue
parent68cce110887cc9fc46fd4c7798f3b8d893f1038f (diff)
downloadmailman-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/queue')
-rw-r--r--Mailman/queue/__init__.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Mailman/queue/__init__.py b/Mailman/queue/__init__.py
index c415834ba..6a1873d60 100644
--- a/Mailman/queue/__init__.py
+++ b/Mailman/queue/__init__.py
@@ -140,7 +140,13 @@ class Switchboard:
msg = cPickle.load(fp)
data = cPickle.load(fp)
if data.get('_parsemsg'):
+ # Calculate the original size of the text now so that we won't
+ # have to generate the message later when we do size restriction
+ # checking.
+ original_size = len(msg)
msg = email.message_from_string(msg, Message.Message)
+ msg.original_size = original_size
+ data['original_size'] = original_size
return msg, data
def finish(self, filebase, preserve=False):