Sam Cannell wrote:
>
>I'd prefer to do it this way, however I haven't really worked much with
>that side of mailman.  I've looked around the mailman site for
>information about the classes and functions I have access to through
>withlist, but haven't had a lot of luck.  Is there any documentation
>like this online?


You want to do this under withlist just to provide the proper
environment for the unpickling. In my previous message I suggested
calling the process() function in SMTPDirect.py as a posibility, but I
think that may not work because SMTPDirect expects to be called from
OutgoingRunner. Anyway, I did a little test as follows:

[EMAIL PROTECTED] ~]$ bin/withlist list1
Loading list list1 (unlocked)
The variable `m' is the list1 MailList instance
>>> import pickle
>>> fp = open('path/to/queue/entry.pck','rb')
>>> msg = pickle.load(fp)
>>> msgdata = pickle.load(fp)
>>> fp.close()
>>> msgdata['recips']
['[EMAIL PROTECTED]']

You may or may not want to do this as the list may be large

At this point you probably want to do something like

r = msgdata['recips']
del r[r.index("'[EMAIL PROTECTED]'")]
msgdata['recips'] = r

Then write it to a new pickle:

>>> fp = open('path/to/new/entry.pck','wb')
>>> pickle.dump(msg, fp)
>>> pickle.dump(msgdata, fp)
>>> fp.close()
>>>                    (control-D here to quit)
Finalizing
[EMAIL PROTECTED] ~]$

At this point, you may want to check with show_qfiles or dumpdb to see
that the new entry looks right. You could diff the outputs of dumpdb
applied to both pickle files to see that only the recips list changed.

Ultimately, you want to give the new file the same name as the old (the
name consists of a time and a hash and should be the right format),
and then move it to the out queue and Mailman will do the rest.

-- 
Mark Sapiro <[EMAIL PROTECTED]>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

------------------------------------------------------
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=show&amp;file=faq01.027.htp

Reply via email to