diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-03-12 18:20:05 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-03-12 18:25:18 +0900 |
commit | cfe21cd10d0a140149689dcb893cfc8060744495 (patch) | |
tree | a0e5c993539bbb323277349cfa8ee0a9f98476d2 | |
parent | a85dde7482bb4548801006d3aa29a3c0d91a5bd1 (diff) | |
download | ybd-tristan/clean-output.tar.gz |
pots.py: Use morph_dump() when outputting the exported <target>.ymltristan/clean-output
This ensures consistent ordering of output, dictated by defaults.conf,
and also ensures clean output without escaping strings.
-rw-r--r-- | ybd/pots.py | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/ybd/pots.py b/ybd/pots.py index a66686e..d3641fb 100644 --- a/ybd/pots.py +++ b/ybd/pots.py @@ -20,16 +20,7 @@ import copy from app import config, log from defaults import Defaults from morphs import Morphs - - -# copied from http://stackoverflow.com/questions/21016220 -class ExplicitDumper(yaml.SafeDumper): - """ - A dumper that will never emit aliases. - """ - - def ignore_aliases(self, data): - return True +from morphdumper import morph_dump class Pots(object): @@ -73,8 +64,7 @@ class Pots(object): del value['orig_ref'] with open(filename, 'w') as f: - f.write(yaml.dump(data, default_flow_style=False, - Dumper=ExplicitDumper)) + f.write(morph_dump(data, self.defaults)) log('CHECK', 'Saved yaml definitions at', filename) def _load_pots(self, filename): |