Small glitch and a simple question

James Westby jw+debian at jameswestby.net
Sat Dec 16 02:44:29 CET 2006


On (16/12/06 01:42), Johannes Ranke wrote:
> Hi all,
> 
> I am quite new to python, but I want to use it to automate a packaging 
> task. Changelog() almost works for me :)
> 
> There is a parse error caused by the following line in a changelog
> 
> 
>  -- Douglas Bates <bates at stat.wisc.edu>  Fri, 8 Oct 1999 10:04:55 -0500
> 
> which should rather read
> 
>  -- Douglas Bates <bates at stat.wisc.edu>  Fri,  8 Oct 1999 10:04:55 -0500
>                                               ^ 
> 
> Yes, the difference is the whitespace here... If Changelog() could
> tolerate this, it would make it more bullet-proof, although of course I
> can find a workaround.

Yes I am rather strict about what I will parse where possible (i.e. the
body of the changelog is hard to be strict about, but the headers and
footers are not).

I'm not entirely sure whether the date in your second example if rfc822
compliant as required for policy. Looking at the rfx the format of the
date field is given in BNF, but it does not state whether whitespace is
significant anwhere.

I am not sure what to do about this. I would prefer to keep the parsing
as strict as possible, but I understand the desire to accept syntax that
is accepted by all of the other tools. Certainly if someone points out a
reference that states the rfc allows the above syntax I will support it.

> 
> Another question I have that might sound stupid: If I have a modified
> changelog, how do I write it to the file? I only found
> 
> print changelog
> 
> in the example, but I can't write the object to a file.

The changelog creation is done in the __str__() method, so converting it
to a string will get you the properly formatted changelog. This means
that you can call string = str(changelog) and then write string to the
file.

The code I wrote this module for doesn't currently care about the actual
changelog, it just wants to access the information in an existing one,
so I didn't pay much attention to that end of the API. If you would like
a method with a signature something like

  write_to_file(file)

say the word and it will be in the next version.

Can I ask what you are using the module for? I would be interested in
the uses other people are finding for the code, and any suggestions you
have for how to improve it or what new features may be wanted.

Also if the code is public you could provide me with a copy to use for
regression tests/consideration of your code in any API changes.

Thanks,

James

-- 
  James Westby   --    GPG Key ID: B577FE13    --     http://jameswestby.net/
  seccure key - (3+)k7|M*edCX/.A:n*N!>|&7U.L#9E)Tu)T0>AM - secp256r1/nistp256




More information about the pkg-python-debian-discuss mailing list