Commit Graph

9 Commits

Author SHA1 Message Date
Erik Johnson
002aa88a97
Replace yaml usage with a helper to ensure unicode is handled properly
Without allow_unicode=True, unicode characters are processed through the
str representer and on Python 2 are dumped as a Unicode code point (i.e.
a literal \u0414). This commit makes allow_unicode=True the default in
our salt.utils.yamlloader.safe_dump() helper. It also adds a new
salt.utils.yamlloader.dump() helper which wraps yaml.dump() and also
makes allow_unicode=True the default.

To make importing and using our custom yaml loader/dumper easier, a
convenience module called salt.utils.yaml has been added, which does a
wildcard import from both salt.utils.yamldumper and
salt.utils.yamlloader.

Refs to yaml.load/dump and yaml.safe_load/safe_dump have been updated to
salt.utils.yaml, to ensure that unicode is handled properly.
2018-01-03 14:14:21 -06:00
Erik Johnson
7b13a7df8b
Replace json module usage with a helper to ensure unicode content is handled properly
This adds wrappers for json.dump{,s} which disable `ensure_ascii` by
default.
2017-12-27 09:30:58 -06:00
Pedro Algarvio
2b14375b30 No empty docstrings 2015-07-12 19:26:33 +01:00
Pedro Algarvio
6294c67b12 Nicer handling of user keyboard interruption 2015-07-12 12:37:56 +01:00
Pedro Algarvio
0add87e7b9 Display the failed import reason 2015-07-12 12:30:24 +01:00
Pedro Algarvio
e6df8cbe24 Add allowed choices to output format.
Since we're using the print function, we can specify the file handler to
user and in this case we choose `sys.stderr`
2015-07-12 12:27:26 +01:00
Pedro Algarvio
ef75ea068c Lint fixes to tests/modparser.py 2015-07-12 12:22:28 +01:00
Thomas S Hatch
50a55eca58 Add output options to modparser 2015-07-11 15:36:58 -06:00
Thomas S Hatch
3f282e21f1 Add modparser script 2015-07-11 15:25:36 -06:00