configRoot.find("smtp").find( "general").attrib["activated"]).upper() == "TRUE") if smtpActivated is True: smtpServer = str( configRoot.find("smtp").find("server").attrib["host"]) smtpPort = int( configRoot.find("smtp").find("server").attrib["port"]) smtpFromAddr = str( configRoot.find("smtp").find("general").attrib["fromAddr"]) smtpToAddr = str( configRoot.find("smtp").find("general").attrib["toAddr"]) # parse all alerts for item in configRoot.find("alerts").iterfind("alert"): alert = DbusAlert() # get dbus client settings alert.triggerDelay = int(item.find("dbus").attrib["triggerDelay"]) alert.displayTime = int(item.find("dbus").attrib["displayTime"]) alert.displayReceivedMessage = (str( item.find("dbus").attrib["displayReceivedMessage"]).upper() == "TRUE") # these options are needed by the server to # differentiate between the registered alerts alert.id = int(item.find("general").attrib["id"]) alert.description = str(item.find("general").attrib["description"]) alert.alertLevels = list() for alertLevelXml in item.iterfind("alertLevel"):
updateInterval = int( configRoot.find("update").find("general").attrib["interval"]) updateEmailNotification = (str( configRoot.find("update").find("general").attrib[ "emailNotification"]).upper() == "TRUE") # email notification works only if smtp is activated if (updateEmailNotification is True and smtpActivated is False): raise ValueError("Update check can not have email " + "notification activated when smtp is not activated.") # parse all alerts for item in configRoot.find("alerts").iterfind("alert"): alert = DbusAlert() # get dbus client settings alert.triggerDelay = int(item.find("dbus").attrib["triggerDelay"]) alert.displayTime = int(item.find("dbus").attrib["displayTime"]) alert.displayReceivedMessage = (str(item.find("dbus").attrib[ "displayReceivedMessage"]).upper() == "TRUE") # these options are needed by the server to # differentiate between the registered alerts alert.id = int(item.find("general").attrib["id"]) alert.description = str(item.find("general").attrib["description"]) alert.alertLevels = list() for alertLevelXml in item.iterfind("alertLevel"): alert.alertLevels.append(int(alertLevelXml.text))
configRoot.find("smtp").find("general").attrib[ "activated"]).upper() == "TRUE") if smtpActivated is True: smtpServer = str( configRoot.find("smtp").find("server").attrib["host"]) smtpPort = int( configRoot.find("smtp").find("server").attrib["port"]) smtpFromAddr = str( configRoot.find("smtp").find("general").attrib["fromAddr"]) smtpToAddr = str( configRoot.find("smtp").find("general").attrib["toAddr"]) # parse all alerts for item in configRoot.find("alerts").iterfind("alert"): alert = DbusAlert() # get dbus client settings alert.triggerDelay = int(item.find("dbus").attrib["triggerDelay"]) alert.displayTime = int(item.find("dbus").attrib["displayTime"]) # these options are needed by the server to # differentiate between the registered alerts alert.id = int(item.find("general").attrib["id"]) alert.description = str(item.find("general").attrib["description"]) alert.alertLevels = list() for alertLevelXml in item.iterfind("alertLevel"): alert.alertLevels.append(int(alertLevelXml.text)) # check if description is empty