def load(self): try: for line in open(CONFIG_FILE, 'rb'): line = line.strip() name = line[:line.find(' ')] line = line[len(name) + 1:] vtype = line[:line.find(' ')] value = line[len(vtype) + 1:] try: if vtype == 'long': if value == UNSET_SETTING: value = long(UNSET_ID_NUM) else: value = long(value) elif vtype == 'bool': value = True if value == 'True' else False if name != UNSET_SETTING: self.values[urllib.unquote(name)] = value except ValueError, error: log_error('%s' % error) except IOError: self.values = {} # Check crash self.check_crash() crash_file(False)
def crash(error): from errors import crash_file crash_file(True, error)