[Mailman-Users] Indexing mail right after delivery

Cedric Jeanneret cedric.jeanneret at camptocamp.com
Thu Mar 4 16:10:56 CET 2010


On Thu, 04 Mar 2010 06:49:54 -0800
Mark Sapiro <mark at msapiro.net> wrote:

> On 3/4/2010 4:23 AM, Cedric Jeanneret wrote:
> > 
> > I think I found what's the problem is : the script works now, but as
> > I write my own archiver, it doesn't do the pipermail part (i.e.
> > update mails in archive)... I thought that this code :
> > 
> > mlist = MailList.MailList(maillist, lock=False)
> > msg = email.message_from_file(sys.stdin, Message.Message)
> > f = StringIO(str(sys.stdin))
> > h = HyperArch.HyperArchive(mlist) 
> > h.processUnixMailbox(f)
> > f.close()
> > 
> > did all, but after reading a bit of code, it doesn't exactly. It
> > saves to .mbox file, right ?
> 
> 
> No. It doesn't save to the .mbox file. If you look at the ArchiveMail()
> method in Mailman/Archivers/Archiver.py. it first saves to the .mbox by
> doing
> 
>         if mm_cfg.ARCHIVE_TO_MBOX in (1, 2):
>             self.__archive_to_mbox(msg)
> 
> Then it either calls the external archiver or executes essentially the
> above to archive the mail in the pipermail archive.
> 
> What you are missing is
> 
> h.close()
> 
> and that's why it doesn't work.
> 
> 
> > I tried to find where it does the pipermail stuff, but it's a bit
> > complicated [I'm not so at ease with Python].
> 
> 
> Yes, the archiver is very convoluted because classes are subclassed and
> methods overridden all over. Don't feel bad. I've been looking at it for
> years and still only barely understand it.
> 

hmmm, I use the h.close() a bit after (I catche its latest ID so that I ca build the direct URL for my indexer). But for now, I guess I'm done.
I've opened a bug (didn't figure where I could put my stuff) on launchpad: https://bugs.launchpad.net/mailman/+bug/531942
It contains my scripts, and some informations on how to use them.

Indeed, "arch" script uses locks. I copied it, removed the lock stuff, and used this version. All work fine now.

I'm happy I could understand a bit (well... very little bit) how mailman works.

Thanks again !


-- 
Cédric Jeanneret                 |  System Administrator
021 619 10 32                    |  Camptocamp SA
cedric.jeanneret at camptocamp.com  |  PSE-A / EPFL
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/mailman-users/attachments/20100304/3813ab96/attachment-0001.pgp>


More information about the Mailman-Users mailing list