def validatePage(self): try: config.MYSQL_CREDENTIALS = {"db" : str(self.field("db_name").toString()), "host" : str(self.field("db_host").toString()), "port" : str(self.field("db_port").toString()), "user" : str(self.field("db_user").toString()), "passwd" : str(self.field("db_password").toString()), "table_prefix" : str(self.field("db_prefix").toString()) } sql.test_db(config.MYSQL_CREDENTIALS) except Exception as e: alert = QtGui.QMessageBox() alert.setWindowTitle("Error") alert.setText("Unable to connect to the database.\n"+str(e)) alert.exec_() return False missing_tables = sql.check_tables(config.MYSQL_CREDENTIALS["table_prefix"]) if len(missing_tables) == 0: return True else: alert = QtGui.QMessageBox() alert.setWindowTitle("Error") alert.setText("Tables not found:\n"+", ".join(missing_tables)) alert.exec_() return False
print "[OK]" except: print "[FAILED]" print print "Checking MySQL Access" print "Initialize database connection:", try: sql.initialize(config.MYSQL_CREDENTIALS) print "[OK]" except: print "[FAILED]" exit() print "Checking tables:", failed_tables = sql.check_tables(config.MYSQL_CREDENTIALS["table_prefix"]) if len(failed_tables) == 0: print "[OK]" else: print "[FAILED]" print "Tables - %s doesn't exist." % ", ".join(failed_tables) print "Checking site:", try: sql.check_site(config.ID_SITE) print "[OK]" except: print "[FAILED], site with idsite = %s wasn't found" % config.ID_SITE else: config.read_config(options.config_file) if not (options.start_date or config.CONFIG_START):