zulip_bots: Enforce default config file schema.
This requires the bot's config section to be named
after the bot. All config entries must be contained
in this section.
MODIFY
zulip_bots/zulip_bots/lib.py
zulip_bots/zulip_bots/lib.py
@@ -119,10 +119,9 @@ class ExternalBotHandler(object):
else:
self._rate_limit.show_error_and_exit()
- def get_config_info(self, bot_name, section=None, optional=False):
- # type: (str, Optional[str], Optional[bool]) -> Dict[str, Any]
+ def get_config_info(self, bot_name, optional=False):
+ # type: (str, Optional[bool]) -> Dict[str, Any]
conf_file_path = os.path.realpath(os.path.join(self._root_dir, bot_name + '.conf'))
- section = section or bot_name
config = configparser.ConfigParser()
try:
with open(conf_file_path) as conf:
@@ -131,7 +130,7 @@ class ExternalBotHandler(object):
if optional:
return dict()
raise
- return dict(config.items(section))
+ return dict(config.items(bot_name))
def open(self, filepath):
# type: (str) -> IO[str]

zulip_bots: Enforce default config file schema.

This requires the bot's config section to be named
after the bot. All config entries must be contained
in this section.