Sfoglia il codice sorgente

corr config reader, si

sigi 1 mese fa
parent
commit
874fd34c89
2 ha cambiato i file con 11 aggiunte e 9 eliminazioni
  1. 8 9
      PingPanel.py
  2. 3 0
      changelog

+ 8 - 9
PingPanel.py

@@ -33,7 +33,7 @@ import tornado.websocket
 from tornado.gen import	sleep
 import asyncio
 
-VERSION	= '0.9.20'
+VERSION	= '0.9.21'
 
 konfig_file	= 'config.cfg'
 modal_konfigs = ''
@@ -137,7 +137,7 @@ def	read_config():
 					ping_forever = to_bool(config["Main"]["PingForever"])
 				except KeyError:
 					pass
-				if args.v: print(sect +	": " + key + " = " + config[sect][key])
+				if args.v: print(konfig_file + ": " + sect +	": " + key + " = " + config[sect][key])
 			else:
 				if args.s and sect_file:
 					return
@@ -146,13 +146,12 @@ def	read_config():
 					host_dict[key] = sect.replace('	','_')
 					failed_pingc[key] =	0
 					anz_hosts += 1
-				if args.v: print(sect +	": " + key + " = " + config[sect][key])
+				if args.v: print(konfig_file + ": " + sect +	": " + key + " = " + config[sect][key])
 
 def	read_sections_config():
 	global anz_hosts
-	sect_config	= configparser.ConfigParser(delimiters=('='), comment_prefixes=('#'), allow_no_value=False,	strict=True, empty_lines_in_values=False)
 	try:
-		if sect_config.read([sect_file]) !=	[]:
+		if config.read([sect_file]) !=	[]:
 			pass
 		else:
 			print("Sectionsfile	'" + sect_file + "'	not	found!")
@@ -168,15 +167,15 @@ def	read_sections_config():
 		sys.exit()
 	
 	#print(config.sections())
-	for	sect in	sect_config.sections():
+	for	sect in	config.sections():
 		if (sect ==	"Main"):
 			continue
-		for	key	in sect_config[sect]:
-			#host_dict[key]	= sect_config[sect][key]
+		for	key	in config[sect]:
+			#host_dict[key]	= config[sect][key]
 			host_dict[key] = sect.replace('	','_')
 			failed_pingc[key] =	0
 			anz_hosts += 1
-			if args.v: print(sect +	": " + key + " = " + config[sect][key])
+			if args.v: print(sect_file + ": " + sect +	": " + key + " = " + config[sect][key])
 	
 def	cmd_exists(cmd):
 	path = os.environ["PATH"].split(os.pathsep)

+ 3 - 0
changelog

@@ -1,3 +1,6 @@
+v0.9.21 / 12.10.26, si:
+	- Corr: config parser
+
 v0.9.20 / 8.10.26, si:
 	- New:		- Parameter 'PingForever', see desc. in config.cfg
 	- Changed:	- configuration file handling, see README.