Disambiguates jrnl.update_config and install.update_config

This commit is contained in:
Manuel Ebert 2013-10-17 16:00:27 -07:00
parent be2c511ea4
commit 7e3faeef45
2 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
# encoding: utf-8 # encoding: utf-8
import readline, glob import readline
import glob
import getpass import getpass
try: import simplejson as json try: import simplejson as json
except ImportError: import json except ImportError: import json
@ -25,7 +26,6 @@ default_config = {
}, },
'editor': "", 'editor': "",
'encrypt': False, 'encrypt': False,
'password': "",
'default_hour': 9, 'default_hour': 9,
'default_minute': 0, 'default_minute': 0,
'timeformat': "%Y-%m-%d %H:%M", 'timeformat': "%Y-%m-%d %H:%M",
@ -35,7 +35,7 @@ default_config = {
} }
def update_config(config, config_path=os.path.expanduser("~/.jrnl_conf")): def upgrade_config(config, config_path=os.path.expanduser("~/.jrnl_conf")):
"""Checks if there are keys missing in a given config dict, and if so, updates the config file accordingly. """Checks if there are keys missing in a given config dict, and if so, updates the config file accordingly.
This essentially automatically ports jrnl installations if new config parameters are introduced in later This essentially automatically ports jrnl installations if new config parameters are introduced in later
versions.""" versions."""

View file

@ -109,7 +109,7 @@ def touch_journal(filename):
def update_config(config, new_config, scope): def update_config(config, new_config, scope):
"""Updates a config dict with new values - either global if scope is None """Updates a config dict with new values - either global if scope is None
of config['journals'][scope] is just a string pointing to a journal file, or config['journals'][scope] is just a string pointing to a journal file,
or within the scope""" or within the scope"""
if scope and type(config['journals'][scope]) is dict: # Update to journal specific if scope and type(config['journals'][scope]) is dict: # Update to journal specific
config['journals'][scope].update(new_config) config['journals'][scope].update(new_config)
@ -127,7 +127,7 @@ def cli(manual_args=None):
util.prompt("[There seems to be something wrong with your jrnl config at {0}: {1}]".format(CONFIG_PATH, e.message)) util.prompt("[There seems to be something wrong with your jrnl config at {0}: {1}]".format(CONFIG_PATH, e.message))
util.prompt("[Entry was NOT added to your journal]") util.prompt("[Entry was NOT added to your journal]")
sys.exit(1) sys.exit(1)
install.update_config(config, config_path=CONFIG_PATH) install.upgrade_config(config, config_path=CONFIG_PATH)
original_config = config.copy() original_config = config.copy()
# check if the configuration is supported by available modules # check if the configuration is supported by available modules