Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Commit

Permalink
Merge "Fix configuration handling" patch from Debian & hzbd/kazam#21
Browse files Browse the repository at this point in the history
  • Loading branch information
jlu5 committed Apr 5, 2019
1 parent 1e058de commit 8cbcde7
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions kazam/backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class KazamConfig(ConfigParser):
CONFIGFILE = os.path.join(CONFIGDIR, "kazam.conf")

def __init__(self):
ConfigParser.__init__(self, self.DEFAULTS[0]['keys'])
super().__init__(self)
if not os.path.isdir(self.CONFIGDIR):
os.makedirs(self.CONFIGDIR)
if not os.path.isfile(self.CONFIGFILE):
Expand All @@ -98,10 +98,9 @@ def find_default(self, section, key):
if d_key == key:
return d_section["keys"][key]

def get(self, section, key, raw=True, fallback=None):
def get(self, section, key, **kwargs):
try:
return super(KazamConfig, self).get(section,
key, raw=True, fallback=fallback)
return super(KazamConfig, self).get(section, key, **kwargs)
except NoSectionError:
default = self.find_default(section, key)
self.set(section, key, default)
Expand All @@ -123,9 +122,7 @@ def getboolean(self, section, key):
def set(self, section, option, value):
# If the section referred to doesn't exist (rare case),
# then create it
if not self.has_section(section):
self.add_section(section)
ConfigParser.set(self, section, option, str(value))
super().set(section, option, str(value))

def write(self):
file_ = open(self.CONFIGFILE, "w")
Expand Down

0 comments on commit 8cbcde7

Please sign in to comment.