mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 22:03:13 -07:00
Fixed error handling in config class
This commit is contained in:
parent
4b4ad90271
commit
758c718d57
1 changed files with 9 additions and 11 deletions
|
@ -13,9 +13,9 @@ MOVIE_CONFIG_FILE = os.path.join(PROG_DIR, "autoProcessMovie.cfg")
|
||||||
TV_CONFIG_FILE = os.path.join(PROG_DIR, "autoProcessTv.cfg")
|
TV_CONFIG_FILE = os.path.join(PROG_DIR, "autoProcessTv.cfg")
|
||||||
LOG_FILE = os.path.join(PROG_DIR, "postprocess.log")
|
LOG_FILE = os.path.join(PROG_DIR, "postprocess.log")
|
||||||
|
|
||||||
class configParser(object):
|
class config(object):
|
||||||
|
|
||||||
# link error handlers
|
# link error handling classes
|
||||||
Error = ConfigParser.Error
|
Error = ConfigParser.Error
|
||||||
NoSectionError = ConfigParser.NoSectionError
|
NoSectionError = ConfigParser.NoSectionError
|
||||||
NoOptionError = ConfigParser.NoOptionError
|
NoOptionError = ConfigParser.NoOptionError
|
||||||
|
@ -27,14 +27,12 @@ class configParser(object):
|
||||||
ParsingError = ConfigParser.ParsingError
|
ParsingError = ConfigParser.ParsingError
|
||||||
MissingSectionHeaderError = ConfigParser.MissingSectionHeaderError
|
MissingSectionHeaderError = ConfigParser.MissingSectionHeaderError
|
||||||
|
|
||||||
@staticmethod
|
def __new__(cls, *file):
|
||||||
def config(*file):
|
if not file:
|
||||||
# if no file specified then load our default config
|
file = CONFIG_FILE
|
||||||
if not file:file = CONFIG_FILE
|
|
||||||
|
|
||||||
# load config
|
# load config
|
||||||
parser = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
parser.optionxform = str
|
config.optionxform = str
|
||||||
if parser.read(file):return parser
|
if config.read(file):
|
||||||
|
return config
|
||||||
config = configParser.config
|
|
Loading…
Add table
Add a link
Reference in a new issue