[Mailman-Developers] How To change queue process method
mark at msapiro.net
Wed Jun 18 17:24:48 CEST 2008
Maickel Pandie wrote:
>1. Can you give me the example of dequeue metadata file to get the
>listname of the message please? I need the listname of the message
>because I made my own function to count how many domain as the
>destination of the message and the input of that function is listname
You are creating a huge can of worms, however if you insist ...
In the files() method, you don't want to dequeue the message because
while that will get you the message and the metadata, it will also
remove the queue entry (actually rename it from .pck to .bak). I
suppose you could then rename the .bak back to .pck, but since files()
is really only in the business of preparing a list of entries to be
dequeued by a runner, I think it is best to read the pickle (if you
must) without dequeueing it in the files() method.
So you would do something like:
msg = cPickle.load(fp)
data = cPickle.load(fp)
Then the list name is data.get('listname')
>2. Can you give me any suggestion how to get attachment file size from
You can look at the "Is the message too big?" code in
>3. Is there any function in mailman who can give me the size of the
>message? What variable that I need to get the size of the message?
>(filename, listname, filebase, or other variabel)
With msg and data as above
size = len(msg)
size = len(msg.as_string())
Ask yourself if the cost of all this extra work is not greater than
whatever you think you're going to save.
Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Mailman-Developers