diff options
author | mathieui <mathieui@mathieui.net> | 2014-10-20 20:03:16 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-10-20 21:20:43 +0200 |
commit | 7b01c62e07612a123f3ffe94583f51099e470c3b (patch) | |
tree | 3f0e5976fdaa5e9da2ad057c6dfa4051b823b060 /src/config.py | |
parent | ece9b2082b9d092541d867211924bc2802f878ad (diff) | |
download | poezio-7b01c62e07612a123f3ffe94583f51099e470c3b.tar.gz poezio-7b01c62e07612a123f3ffe94583f51099e470c3b.tar.bz2 poezio-7b01c62e07612a123f3ffe94583f51099e470c3b.tar.xz poezio-7b01c62e07612a123f3ffe94583f51099e470c3b.zip |
Change the API of Config.get_by_tabname
Make the "default" parameter optional and thus move it to the end of
the command with the other optional parameters.
And change all the calls.
Diffstat (limited to 'src/config.py')
-rw-r--r-- | src/config.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/config.py b/src/config.py index 79c7381d..533838e1 100644 --- a/src/config.py +++ b/src/config.py @@ -181,15 +181,16 @@ class Config(RawConfigParser): return default return res - def get_by_tabname( - self, option, default, tabname, - fallback=True, fallback_server=True): + def get_by_tabname(self, option, tabname, + fallback=True, fallback_server=True, default=''): """ Try to get the value for the option. First we look in a section named `tabname`, if the option is not present in the section, we search for the global option if fallback is True. And we return `default` as a fallback as a last resort. """ + if self.default and (not default) and fallback: + default = self.default.get(DEFSECTION, {}).get(option, '') if tabname in self.sections(): if option in self.options(tabname): # We go the tab-specific option |