summaryrefslogtreecommitdiff
path: root/jfr_playoff/settings.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-05-29 22:06:24 +0200
committeremkael <emkael@tlen.pl>2019-05-29 22:06:24 +0200
commitfd4241dc0db5d4ea1bda120a1f1022fb91e85cd2 (patch)
tree997d1a01cfe6cb885ff147029901117b90420dc3 /jfr_playoff/settings.py
parentf0e23167b57f9b942477b6f2b98d84d61dd8e1d7 (diff)
Settings class now accepts an already parsed config object in the constructor
Diffstat (limited to 'jfr_playoff/settings.py')
-rw-r--r--jfr_playoff/settings.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/jfr_playoff/settings.py b/jfr_playoff/settings.py
index 58de66c..b12ffef 100644
--- a/jfr_playoff/settings.py
+++ b/jfr_playoff/settings.py
@@ -13,7 +13,7 @@ def complete_filename(text, state):
class PlayoffSettings(object):
- def __init__(self, config_file):
+ def __init__(self, config_file=None, config_obj=None):
self.settings = None
self.interactive = False
self.settings_file = None
@@ -21,7 +21,10 @@ class PlayoffSettings(object):
self.settings_file = config_file.decode(
sys.getfilesystemencoding())
else:
- self.interactive = True
+ if config_obj is not None:
+ self.settings = config_obj
+ else:
+ self.interactive = True
def __merge_config(self, base_config,
new_config=None, remote_url=None,
@@ -39,7 +42,7 @@ class PlayoffSettings(object):
return base_config
def load(self):
- if self.settings_file is None:
+ if self.interactive:
readline.set_completer_delims(' \t\n;')
readline.parse_and_bind("tab: complete")
readline.set_completer(complete_filename)