summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Soto2013-01-23 18:07:38 +0100
committerDavid Soto2013-01-23 18:07:38 +0100
commitc14d897b28527dd54e8537eb64c2e6149f83d99d (patch)
tree8243e41fb734a079e11511f2bcb2aec2c7a4fa0c /src
parentbd919566ce24ee29250b0926d9cf2c8007d23bcc (diff)
downloadmailman-c14d897b28527dd54e8537eb64c2e6149f83d99d.tar.gz
mailman-c14d897b28527dd54e8537eb64c2e6149f83d99d.tar.zst
mailman-c14d897b28527dd54e8537eb64c2e6149f83d99d.zip
Diffstat (limited to 'src')
-rw-r--r--src/mailman/commands/cli_mailmanconf.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mailman/commands/cli_mailmanconf.py b/src/mailman/commands/cli_mailmanconf.py
index d11cb4bfe..82eebb0e3 100644
--- a/src/mailman/commands/cli_mailmanconf.py
+++ b/src/mailman/commands/cli_mailmanconf.py
@@ -63,8 +63,8 @@ class Mailmanconf:
def __print_full_syntax(self, section, key, value, output):
print('[{0}] {1}: {2}'.format(section, key, value), file=output)
- def __show_key_error(self, key):
- self.parser.error('No such key: %s' % key)
+ def __show_key_error(self, section, key):
+ self.parser.error('Section %s: No such key: %s' % (section, key))
def __show_section_error(self, section):
self.parser.error('No such section: %s' % section)
@@ -92,7 +92,11 @@ class Mailmanconf:
key = args.key
# Case 1: Both section and key are given, we can directly look up the value
if section is not None and key is not None:
- if self.__section_exists(section) and hasattr(getattr(config, section), key):
+ if not self.__section_exists(section):
+ self.__show_section_error(section)
+ elif not hasattr(getattr(config, section), key):
+ self.__show_key_error(section, key)
+ else:
print(self.__get_value(section, key))
# Case 2: Section is given, key is not given
elif section is not None and key is None: