- self.config["fontSize"] = configParser.getint(section, "fontSize")
- self.config["artFontSize"] = configParser.getint(section, "artFontSize")
- self.config["expiry"] = configParser.getint(section, "expiry")
- self.config["autoupdate"] = configParser.getboolean(section, "autoupdate")
- self.config["updateInterval"] = configParser.getfloat(section, "updateInterval")
- self.config["orientation"] = configParser.get(section, "orientation")
- self.config["imageCache"] = configParser.getboolean(section, "imageCache")
- except:
- self.config["fontSize"] = 17
- self.config["artFontSize"] = 14
- self.config["expiry"] = 24
- self.config["autoupdate"] = False
- self.config["updateInterval"] = 4
- self.config["orientation"] = "Automatic"
- self.config["imageCache"] = False
- try:
- self.config["proxy"] = configParser.getboolean(section, "proxy")
- except:
- self.config["proxy"] = True
- try:
- self.config["hidereadfeeds"] = configParser.getboolean(section, "hidereadfeeds")
- self.config["hidereadarticles"] = configParser.getboolean(section, "hidereadarticles")
- except:
- self.config["hidereadfeeds"] = False
- self.config["hidereadarticles"] = False
- try:
- self.config["extBrowser"] = configParser.getboolean(section, "extBrowser")
- except:
- self.config["extBrowser"] = False
- try:
- self.config["feedsort"] = configParser.get(section, "feedsort")
- except:
- self.config["feedsort"] = "Manual"
- try:
- self.config["theme"] = configParser.get(section, "theme")
- except:
- self.config["theme"] = True
-
+ except Exception:
+ logger.exception("Reading %s", self.configFilename)
+
+ # The function to use to fetch the parameter, the parameter's
+ # name and the default value.
+ values = ((configParser.getint, "fontSize", 17),
+ (configParser.getint, "artFontSize", 14),
+ (configParser.getint, "expiry", 24),
+ (configParser.getboolean, "autoupdate", False),
+ (configParser.getboolean, "woodchuck", True),
+ (configParser.getboolean, "askedAboutWoodchuck", False),
+ (configParser.getint, "updateInterval", 4),
+ (configParser.get, "orientation", "Automatic"),
+ (configParser.getboolean, "imageCache", False),
+ (configParser.getboolean, "proxy", True),
+ (configParser.getboolean, "hidereadfeeds", False),
+ (configParser.getboolean, "hidereadarticles", False),
+ (configParser.getboolean, "extBrowser", False),
+ (configParser.getboolean, "theme", True),
+ (configParser.get, "feedsort", "Manual"))
+
+ for fetcher, name, default in values:
+ try:
+ v = fetcher(section, name)
+ except Exception:
+ logger.exception("Reading config variable %s", name)
+ v = default
+ self.config[name] = v
+