From bb40c1166b7122634335fdac18f73e911e13d391 Mon Sep 17 00:00:00 2001 From: yarko Date: Tue, 22 Jul 2014 11:57:09 -0500 Subject: [PATCH] tentatively using dump() in place of safe_dump(), and no default_flow_style; safe_dump() probably only needed for converting from old json config - a separate utility would do for that --- jrnl/install.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/jrnl/install.py b/jrnl/install.py index 5bc0b51d..269623ef 100644 --- a/jrnl/install.py +++ b/jrnl/install.py @@ -43,14 +43,18 @@ def upgrade_config(config, config_path): for key in missing_keys: config[key] = default_config[key] with open(config_path, 'w') as f: - yaml.safe_dump(config, f, indent=2, allow_unicode=True) + yaml.dump(config, f, indent=2, default_flow_style=False) + # when converting from original json version, + # needed to quiet the yaml explicit unicode marking + # yaml.safe_dump(config, f, indent=2, allow_unicode=True) print("[.jrnl_conf updated to newest version]") # def save_config(config=default_config, config_path): def save_config(config, config_path): with open(config_path, 'w') as f: - yaml.safe_dump(config, f, indent=2, allow_unicode=True) + # yaml.safe_dump(config, f, indent=2, allow_unicode=True) + yaml.dump(config, f, indent=2, default_flow_style=False) def install_jrnl(config_path): @@ -92,7 +96,8 @@ def install_jrnl(config_path): # Write config to ~/.jrnl_conf.yml with open(config_path, 'w') as f: - yaml.dump(default_config, f, indent=2, allow_unicode=True) + # yaml.safe_dump(default_config, f, indent=2, allow_unicode=True) + yaml.dump(config, f, indent=2, default_flow_style=False) config = default_config if password: config['password'] = password