From 86f00a6cec71753952d1290bdadd836fdba5fdc1 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sat, 29 Dec 2007 19:53:23 -0500 Subject: 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. --- Mailman/queue/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Mailman/queue') 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): -- cgit v1.2.3-70-g09d2