[Mailman-Developers] nightly_gzip - more than a little broken...

Thomas Wouters thomas@xs4all.net
Sun, 13 Feb 2000 14:07:09 +0100


On Wed, Feb 09, 2000 at 04:51:19PM +0000, Nigel Metheringham wrote:

> I wondered why the nightly_gzip program was not working correctly on 
> some of my lists - one (a high traffic list) has weekly based 
> archiving, the other (an announce list) has quarterly based archiving.

> A very quick look at the code shows:-
>         for f in allfiles:
>             try:
>                 time.strptime(f, '%Y-%B.txt')
>             except ValueError:
>                 continue

> that strptime seems to be ensuring that the archive mbox files have a 
> year and month in their names before a .txt - and this only applies to 
> monthly archives in practice.

> Would there be any problems with just changing this to be a regexp 
> match for '\.txt$' instead?  If you really want to check its an archive 
> then look for a directory x with a file x.txt .

Well, there is another problem with using time.strptime(): it's not
portable. BSDI does not have strptime(), and I'm sure several operating
systems dont have it either. Using re or some such to check on '\.txt$'
seems like intense overkill, though. Why not:

for f in alfiles:
    if f[-4:] <> ".txt":
        continue

One might even consider 'string.lower(f[-4:])', though that would not be
totally compatible. Would there by any other .txt files in that directory,
that should not be compressed ?

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!