summarylogtreecommitdiffstats
path: root/configparser_api_changes.patch
blob: 9463840efb035c8cd052b004e0142c37e9b5fa93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From: Andrew Starr-Bochicchio <asb@debian.org>
Date: Tue, 4 Jun 2019 15:33:36 +0300
Subject: Update for changes in ConfigParser api.

Bug: #801203, #916416, LP: #1500083
Forwarded: https://github.com/hzbd/kazam/pull/21
Author: Andrew Starr-Bochicchio <asb@debian.org>
Author: Sergey Spitsyn <sswebcoder@gmail.com>
Reviewed-by: Nicolas Braud-Santoni <nicoo@debian.org>
---
 kazam/backend/config.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/kazam/backend/config.py b/kazam/backend/config.py
index 59a6c5a..2274435 100644
--- a/kazam/backend/config.py
+++ b/kazam/backend/config.py
@@ -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):
@@ -98,9 +98,9 @@ class KazamConfig(ConfigParser):
                     if d_key == key:
                         return d_section["keys"][key]
 
-    def get(self, section, key):
+    def get(self, section, key, **kwargs):
         try:
-            return ConfigParser.get(self, section, key)
+            return super(KazamConfig, self).get(section, key, **kwargs)
         except NoSectionError:
             default = self.find_default(section, key)
             self.set(section, key, default)
@@ -122,9 +122,7 @@ class KazamConfig(ConfigParser):
     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")