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") 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 config(ConfigParser.ConfigParser): class configParser(object):
# link error handlers # link error handlers
Error = ConfigParser.Error Error = ConfigParser.Error
@ -27,15 +27,14 @@ class config(ConfigParser.ConfigParser):
ParsingError = ConfigParser.ParsingError ParsingError = ConfigParser.ParsingError
MissingSectionHeaderError = ConfigParser.MissingSectionHeaderError MissingSectionHeaderError = ConfigParser.MissingSectionHeaderError
def __init__(self, *file): @staticmethod
try: def config(*file):
ConfigParser.ConfigParser.__init__(self) # if no file specified then load our default config
self.optionxform = str if not file:file = CONFIG_FILE
if not file:
file = CONFIG_FILE # load config
if self.read(file): parser = ConfigParser.ConfigParser()
pass parser.optionxform = str
else: if parser.read(file):return parser
raise self.Error('Cannot open configuration file')
except IOError, error: config = configParser.config
exit(error)