Skip to content

Commit

Permalink
- OscConfigParser: added "proper" parameter to the has_option method
Browse files Browse the repository at this point in the history
This can be used to check if the option belongs to the section or is
just "inherited" from the defaults.
  • Loading branch information
marcus-h committed Jun 4, 2014
1 parent a833120 commit e2abfe9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions osc/OscConfigParser.py
Expand Up @@ -323,6 +323,16 @@ def write(self, fp, comments = False):
else:
configparser.SafeConfigParser.write(self, fp)

def has_option(self, section, option, proper=False, **kwargs):
"""
Returns True, if the passed section contains the specified option.
If proper is True, True is only returned if the option is owned by
this section and not "inherited" from the default.
"""
if proper:
return self.optionxform(option) in self._sections[section].keys()
return configparser.SafeConfigParser.has_option(self, section, option, **kwargs)

# XXX: simplify!
def __str__(self):
ret = []
Expand Down

0 comments on commit e2abfe9

Please sign in to comment.