blob: 359bdd803f7d76d8f1a43275195c6d65a9a9e4e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#
#-*- coding:utf-8 -*-
try:
from configparser import ConfigParser
from configparser import NoSectionError
except:
from ConfigParser import ConfigParser, NoSectionError
class SaneConfigParser(ConfigParser):
'''This class overrides what I consider a buggy RawConfigParser.options()'''
def options(self, section):
"""Return a list of option names for the given section name."""
try:
opts = self._sections[section].copy()
except KeyError:
raise NoSectionError(section)
if '__name__' in opts:
del opts['__name__']
return list(opts.keys())
|