From 71b6cc6db9c9fe371ea43aa969ee74d8a1083170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Ricart?= Date: Thu, 8 Mar 2018 21:04:43 +0100 Subject: [PATCH] add add_option function --- esp8266/uConfigParser.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/esp8266/uConfigParser.py b/esp8266/uConfigParser.py index e44a337..23ad026 100644 --- a/esp8266/uConfigParser.py +++ b/esp8266/uConfigParser.py @@ -18,6 +18,13 @@ class ConfigParser: else: return False + def add_option(self, section, option): + """Create a new option in the configuration.""" + if self.has_section(section) and not option in self.config_dict[section]: + self.config_dict[section][option] = None + else: + raise + def options(self, section): """Return a list of option names for the given section name.""" if not section in self.config_dict: