mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-27 00:28:55 +02:00
- OscConfigParser: added "proper" parameter to the has_option method
This can be used to check if the option belongs to the section or is just "inherited" from the defaults.
This commit is contained in:
@@ -323,6 +323,16 @@ class OscConfigParser(configparser.SafeConfigParser):
|
|||||||
else:
|
else:
|
||||||
configparser.SafeConfigParser.write(self, fp)
|
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!
|
# XXX: simplify!
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
ret = []
|
ret = []
|
||||||
|
Reference in New Issue
Block a user