mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -07:00
Fixed bug in new config class that was preventing it from not creating a instance based on our conditional checks.
This commit is contained in:
parent
c49fb9586f
commit
3564abf11c
1 changed files with 12 additions and 13 deletions
|
@ -13,7 +13,7 @@ MOVIE_CONFIG_FILE = os.path.join(PROG_DIR, "autoProcessMovie.cfg")
|
|||
TV_CONFIG_FILE = os.path.join(PROG_DIR, "autoProcessTv.cfg")
|
||||
LOG_FILE = os.path.join(PROG_DIR, "postprocess.log")
|
||||
|
||||
class config(ConfigParser.ConfigParser):
|
||||
class configParser(object):
|
||||
|
||||
# link error handlers
|
||||
Error = ConfigParser.Error
|
||||
|
@ -27,15 +27,14 @@ class config(ConfigParser.ConfigParser):
|
|||
ParsingError = ConfigParser.ParsingError
|
||||
MissingSectionHeaderError = ConfigParser.MissingSectionHeaderError
|
||||
|
||||
def __init__(self, *file):
|
||||
try:
|
||||
ConfigParser.ConfigParser.__init__(self)
|
||||
self.optionxform = str
|
||||
if not file:
|
||||
file = CONFIG_FILE
|
||||
if self.read(file):
|
||||
pass
|
||||
else:
|
||||
raise self.Error('Cannot open configuration file')
|
||||
except IOError, error:
|
||||
exit(error)
|
||||
@staticmethod
|
||||
def config(*file):
|
||||
# if no file specified then load our default config
|
||||
if not file:file = CONFIG_FILE
|
||||
|
||||
# load config
|
||||
parser = ConfigParser.ConfigParser()
|
||||
parser.optionxform = str
|
||||
if parser.read(file):return parser
|
||||
|
||||
config = configParser.config
|
Loading…
Add table
Add a link
Reference in a new issue