Alex Henderson added the comment:
Proposed patch copied over from duplicate issue 17372.
--
keywords: +patch
nosy: +alex.henderson
Added file: http://bugs.python.org/file31168/issue14465.patch
___
Python tracker rep...@bugs.python.org
http
Alex Henderson added the comment:
OK, now raises ValueError on passing anything other than 'strict'.
Note that for the incremental classes I've put checking in __init__ so that
ValueError is raised when non-'strict' values are passed to the constructor,
not when the incremental encode/decode
Alex Henderson added the comment:
I have attached a proposed patch.
This makes some design decisions which I would like someone to review:
a) To incorporate pretty-printing into the main write() method rather than
adding a separate toprettyxml() method. Disadvantages: greater complexity
Alex Henderson added the comment:
Having discussed this with Ezio, I think the better option might be to raise
ValueError instead - if someone is expecting to be able to silently recover
from errors they won't be able to, and should find out about this sooner rather
than later.
I'll upload
Alex Henderson added the comment:
One other design decision - currently it doesn't deal with the indentation of
comments or processing instructions: it leaves them unindented. Should they be
indented the same as other tags?
--
___
Python tracker
Alex Henderson added the comment:
I see that there is identical usage of assert errors=='strict' in a number of
similar encodings modules:
base64_codec.py
bz2_codec.py
hex_codec.py
quopri_codec.py
uu_codec.py
zlib_codec.py
The error handling mode is irrelevant for all these codecs, so