diff --git a/earwigbot/config.py b/earwigbot/config.py index f62791d..9358509 100644 --- a/earwigbot/config.py +++ b/earwigbot/config.py @@ -66,7 +66,7 @@ class _ConfigNode(object): data = self.__dict__.copy() for key, val in data.iteritems(): if isinstance(val, _ConfigNode): - data[key] = val.dump() + data[key] = val._dump() return data def _load(self, data): diff --git a/earwigbot/main.py b/earwigbot/main.py index e264ac7..59b3cfd 100644 --- a/earwigbot/main.py +++ b/earwigbot/main.py @@ -88,7 +88,7 @@ def irc_frontend(): logger.info("Starting IRC frontend") frontend = Frontend() - if "wiki_schedule" in config.components: + if config.components.get("wiki_schedule"): logger.info("Starting wiki scheduler") tasks.load() t_scheduler = threading.Thread(target=wiki_scheduler) @@ -96,7 +96,7 @@ def irc_frontend(): t_scheduler.daemon = True t_scheduler.start() - if "irc_watcher" in config.components: + if config.components.get("irc_watcher"): logger.info("Starting IRC watcher") t_watcher = threading.Thread(target=irc_watcher, args=(frontend,)) t_watcher.name = "irc-watcher" @@ -110,12 +110,12 @@ def irc_frontend(): f_conn.close() def main(): - if "irc_frontend" in config.components: + if config.components.get("irc_frontend"): # Make the frontend run on our primary thread if enabled, and enable # additional components through that function: irc_frontend() - elif "wiki_schedule" in config.components: + elif config.components.get("wiki_schedule"): # Run the scheduler on the main thread, but also run the IRC watcher on # another thread iff it is enabled: logger.info("Starting wiki scheduler") @@ -128,7 +128,7 @@ def main(): t_watcher.start() wiki_scheduler() - elif "irc_watcher" in config.components: + elif config.components.get("irc_watcher"): # The IRC watcher is our only enabled component, so run its function # only and don't worry about anything else: logger.info("Starting IRC watcher")