Merge branch '3-add-add_option-function' into 'master'
Resolve "add add_option function" Closes #3 See merge request Milka64/uHodor!2
This commit is contained in:
commit
e774835f03
1 changed files with 7 additions and 0 deletions
|
@ -18,6 +18,13 @@ class ConfigParser:
|
||||||
else:
|
else:
|
||||||
return False
|
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):
|
def options(self, section):
|
||||||
"""Return a list of option names for the given section name."""
|
"""Return a list of option names for the given section name."""
|
||||||
if not section in self.config_dict:
|
if not section in self.config_dict:
|
||||||
|
|
Loading…
Reference in a new issue