fix: Settings name translation has to check the existence of key

In the 'xml_setconfig' function, the names of the passed dictionary
are translated into new names. However, there is no obligation to
hand over all fields in the setting dict. This bugfix checks whether
the keys exist before translating.

Refs: 6d56c667
Signed-off-by: Sven Sager <akira@narux.de>
This commit is contained in:
2023-10-26 07:41:51 +02:00
parent 87effde838
commit 5b4c799c98

View File

@@ -1294,8 +1294,9 @@ class RevPiPyLoad:
("plcslaveport", "plcserverport"), ("plcslaveport", "plcserverport"),
("plcslavewatchdog", "plcserverwatchdog"), ("plcslavewatchdog", "plcserverwatchdog"),
): ):
dc[key_to] = dc[key_from] if key_from in dc:
del dc[key_from] dc[key_to] = dc[key_from]
del dc[key_from]
# Werte übernehmen, die eine Definition in key haben (andere nicht) # Werte übernehmen, die eine Definition in key haben (andere nicht)
for sektion in keys: for sektion in keys: