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

This commit is contained in:
yarko 2014-07-22 11:57:09 -05:00
parent 4dde183484
commit bb40c1166b

View file

@ -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