[PATCH 6/6] Clarify a comment
Filippo Giunchedi
filippo at debian.org
Sat Aug 1 08:46:59 UTC 2009
On Wed, Jul 29, 2009 at 03:44:53PM +0200, John Wright wrote:
> > diff --git a/debian_bundle/deb822.py b/debian_bundle/deb822.py
> > index 3fffa4a..a71ffcc 100644
> > --- a/debian_bundle/deb822.py
> > +++ b/debian_bundle/deb822.py
> > @@ -332,10 +332,12 @@ class Deb822(Deb822Dict):
> > else:
> > return_string = False
> > for key, value in self.iteritems():
> > + # We want one space between the "Field:" and value, unless
> > + # value starts with a newline (i.e. the value itself started on
> > + # the line *after* the field name in the control file), or is
> > + # empty. In that case, we avoid trailing whitespace by by not
> > + # including a space after the colon.
> > if not value or value[0] == '\n':
> > - # Avoid trailing whitespace after "Field:" if it's on its own
> > - # line or the value is empty
> > - # XXX Uh, really print value if value == '\n'?
> > fd.write('%s:%s\n' % (key, value))
> > else:
> > fd.write('%s: %s\n' % (key, value))
>
> Only now I actually understand what the XXX comment was asking...
> Really, we want to make sure that values don't end in a newline, or
> we'll effectively be making a new stanza when we add the newline to it
> here.
>
> I wonder if it would actually make more sense to have a value-sanitizer
> method, which basically returns value.strip() after first making sure
> there are no empty lines in value.
is it going to be reused elsewhere? Perhaps clarifying the comment would be
enough, adding a function call might slow down dump() at least AFAICT
filippo
--
Filippo Giunchedi - http://esaurito.net - 0x6B79D401
Computer Science is no more about computers than astronomy is about telescopes.
-- Edsger Dijkstra
More information about the pkg-python-debian-discuss
mailing list