[issue1777134] minidom pretty xml output improvement

Tres Seaver report at bugs.python.org
Sun May 2 22:16:47 CEST 2010


Tres Seaver <tseaver at agendaless.com> added the comment:

The patch applies cleanly to the 2.6 branch, and with minimal fuzz to
the trunk.  Exsting tests pass in both cases, as does the new test.

The added testcase seems plainly correct.

The first hunk of the  diff to Lib/xml/dom/minidom.py is a little messy
/ hard to follow:

- It makes the module less PEP8 conformant (line length > 80, operator
  spacing)

- The 'onetextnode' flag is set, but never used.

The second hunk is somewhat problematic:  it changes 'Text.writexml' to
ignore any explicit 'indent' or 'newl' argument passed, which is a
backwards-incompatible behavior change.  Perhaps changing the default
values for those arguments to 'None', and then using the new code path
in that case, would be the better course, while falling back to the old
one if either is passed.

I'm not sure about the justification for the third hunk at all (removing
the newline at the end of the XML prologue).  There *can't* be any
meaningful whitespace outside of the root element, so we shouldn't have
round-trip issues if we leave it.

----------
nosy: +tseaver

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1777134>
_______________________________________


More information about the Python-bugs-list mailing list