Commit 122122b7 authored by Samuel GAIST's avatar Samuel GAIST

Merge branch 'config-set-dont-save' into 'master'

Do not save config when just setting a value on it

Closes beat.editor#277

See merge request !99
parents bcbaa84e 38cf79e3
Pipeline #41545 passed with stages
in 8 minutes and 37 seconds
...@@ -114,7 +114,7 @@ class Configuration(object): ...@@ -114,7 +114,7 @@ class Configuration(object):
return dict((k, self.__data[k]) for k in self.__data if self.is_database_key(k)) return dict((k, self.__data[k]) for k in self.__data if self.is_database_key(k))
def set(self, key, value, local=False): def set(self, key, value):
"""Sets or resets a field in the configuration""" """Sets or resets a field in the configuration"""
if not self._is_valid_key(key): if not self._is_valid_key(key):
...@@ -126,8 +126,6 @@ class Configuration(object): ...@@ -126,8 +126,6 @@ class Configuration(object):
elif key in DEFAULTS: elif key in DEFAULTS:
self.__data[key] = DEFAULTS[key] self.__data[key] = DEFAULTS[key]
self.save(local)
def save(self, local=False): def save(self, local=False):
"""Saves contents to configuration file """Saves contents to configuration file
...@@ -256,6 +254,7 @@ def set(ctx, args, local): ...@@ -256,6 +254,7 @@ def set(ctx, args, local):
try: try:
for idx in range(0, len(args), 2): for idx in range(0, len(args), 2):
ctx.meta["config"].set(args[idx], args[idx + 1], local) ctx.meta["config"].set(args[idx], args[idx + 1])
ctx.meta["config"].save(local)
except Exception: except Exception:
raise click.ClickException("Failed to change the configuration.") raise click.ClickException("Failed to change the configuration.")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment