Get an option value for given section/option or return default. If type is specified, return as type.
(self, section, option, type=None, default=None, raw=False)
| 48 | ConfigParser.__init__(self, defaults=cfgDefaults, strict=False) |
| 49 | |
| 50 | def Get(self, section, option, type=None, default=None, raw=False): |
| 51 | """ |
| 52 | Get an option value for given section/option or return default. |
| 53 | If type is specified, return as type. |
| 54 | """ |
| 55 | # TODO Use default as fallback, at least if not None |
| 56 | # Should also print Warning(file, section, option). |
| 57 | # Currently may raise ValueError |
| 58 | if not self.has_option(section, option): |
| 59 | return default |
| 60 | if type == 'bool': |
| 61 | return self.getboolean(section, option) |
| 62 | elif type == 'int': |
| 63 | return self.getint(section, option) |
| 64 | else: |
| 65 | return self.get(section, option, raw=raw) |
| 66 | |
| 67 | def GetOptionList(self, section): |
| 68 | "Return a list of options for given section, else []." |