From 7c433dcf95d60bd86b287e7846ee9fcbd9cf538e Mon Sep 17 00:00:00 2001 From: Gra Date: Fri, 24 Apr 2009 20:38:37 +0200 Subject: [PATCH] Improved readability of KeyLogger.ParseConfigFile. --- keylogger.pyw | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/keylogger.pyw b/keylogger.pyw index 0cdfd17..6eab679 100644 --- a/keylogger.pyw +++ b/keylogger.pyw @@ -206,24 +206,32 @@ class KeyLogger: ''' if not os.path.isabs(self.cmdoptions.configfile): - self.cmdoptions.configfile = os.path.join(myutils.get_main_dir(), self.cmdoptions.configfile) + self.cmdoptions.configfile = os.path.join( + myutils.get_main_dir(), self.cmdoptions.configfile) if not os.path.isabs(self.cmdoptions.configval): - self.cmdoptions.configval = os.path.join(myutils.get_main_dir(), self.cmdoptions.configval) + self.cmdoptions.configval = os.path.join( + myutils.get_main_dir(), self.cmdoptions.configval) - self.settings=ConfigObj(self.cmdoptions.configfile, configspec=self.cmdoptions.configval, list_values=False) + self.settings = ConfigObj(self.cmdoptions.configfile, + configspec=self.cmdoptions.configval, + list_values=False) # validate the config file - errortext="Some of your input contains errors. Detailed error output below.\n\n" + errortext = "Some of your input contains errors. " + \ + "Detailed error output below.\n\n" val = Validator() valresult = self.settings.validate(val, preserve_errors=True) + error_tpl = "Error in item \"%s\": %s\n" if valresult != True: for section in valresult.keys(): if valresult[section] != True: sectionval = valresult[section] for key in sectionval.keys(): if sectionval[key] != True: - errortext += "Error in item \"" + str(key) + "\": " + str(sectionval[key]) + "\n" - tkMessageBox.showerror("Errors in config file. Exiting.", errortext) + errortext += error_tpl % \ + (str(key), str(sectionval[key])) + tkMessageBox.showerror("Errors in config file. Exiting.", + errortext) sys.exit() def NagscreenLogic(self): -- 2.45.1