This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/master by this push:
new 72cac2e Section contents can be None
72cac2e is described below
commit 72cac2e09ab2215a2c264f117030d12ffd9435b4
Author: Sebb <[email protected]>
AuthorDate: Sat Aug 22 21:03:31 2020 +0100
Section contents can be None
---
tools/plugins/ponymailconfig.py | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/tools/plugins/ponymailconfig.py b/tools/plugins/ponymailconfig.py
index c2530e9..1ceef0b 100755
--- a/tools/plugins/ponymailconfig.py
+++ b/tools/plugins/ponymailconfig.py
@@ -40,18 +40,15 @@ class PonymailConfig(object):
def has_section(self, section):
val = section in self.config
-# print("?", section, val)
return val
def has_option(self, section, option):
- val = section in self.config and option in self.config[section]
-# print("?", section, option, val)
+ val = section in self.config and self.config[section] and option in
self.config[section]
return val
def get(self, section, option, fallback=None):
- try:
+ if self.has_option(section, option):
val = self.config[section][option] or fallback
- except KeyError:
+ else:
val = fallback
-# print(">", section, option, fallback, val)
return val