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:
echel0n 2014-04-01 21:13:57 -07:00
commit 3564abf11c

View file

@ -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