[Mailman-Users] [Solved] Importing Archives Not Working

Karl Zander kwz-mm at commpartners.com
Sat Mar 4 19:08:05 CET 2006


Thank you to everyone who replied to this thread.

The python code from Mark below worked nicley to convert 
the date formats.  My imported archives are visiable in 
Mailman.

--Karl


On Fri, 3 Mar 2006 17:43:15 -0800
  Mark Sapiro <msapiro at value.net> wrote:

> The method in the FAQ is much more complete than the 
>following, but it
> is also more cumbersome if you don't already have 
>formail and procmail
> installed.
> 
>For a one time Quick and dirty to convert:
> 
>   From user at example.com Thu, 01 Dec 2005 15:02:08 -0500
> 
> to
> 
>   From user at example.com Thu Dec  1 15:02:08 2005
> 
> You can try the following:
> 
> python script.py <old_mbox >new_mbox
> 
> where script.py is between the dashed lines
> ----------------------------------------------------------
> import sys
> import time
> 
> for line in sys.stdin.readlines():
>    if line.startswith('From '):
>        fields = line.split()
>        date = ' '.join(fields[2:7])
>        try:
>            t = time.strptime(date, '%a, %d %b %Y 
>%H:%M:%S')
>            newtime = time.asctime(t)
>            line = ' '.join(fields[0:2] + [newtime] + 
>['\n'])
>        except ValueError:
>            pass
> 
>    sys.stdout.writelines([line])
> ----------------------------------------------------------
> 
> (I should add this to the FAQ)
> 
> -- 
> Mark Sapiro <msapiro at value.net>       The highway is for 
>gamblers,
> San Francisco Bay Area, California    better use your 
>sense - B. Dylan
> 



More information about the Mailman-Users mailing list