Skip to content

Commit ee85891

Browse files
authored
Merge pull request #1011 from CaeruleusAqua/parse_knx_proj_error
KNX Plugin: update type check due to xmltodict no longer returning OrderedDict
2 parents 5097f15 + 452511f commit ee85891

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

knx/knxproj.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import logging
2727

2828
from pathlib import Path
29-
from collections import OrderedDict
3029
import xmltodict
3130

3231
logger = logging.getLogger("knxproject")
@@ -265,7 +264,7 @@ def _parse_knxproject(filename, password=None):
265264
top = ga_dict.get('GroupRange',None)
266265
if top is None: return GAs
267266

268-
if isinstance(top, OrderedDict):
267+
if not isinstance(top, list):
269268
# if there is only one child defined in xml, an ordered dict is
270269
# returned here instead of a list
271270
# so we need to convert it to a list
@@ -277,7 +276,7 @@ def _parse_knxproject(filename, password=None):
277276
middle_dict = middle.get('GroupRange',None)
278277
if middle_dict is None: continue
279278

280-
if isinstance( middle_dict, OrderedDict):
279+
if not isinstance( middle_dict, list):
281280
# same as above
282281
middle_ga = [middle_dict]
283282
else:
@@ -288,7 +287,7 @@ def _parse_knxproject(filename, password=None):
288287

289288
if last_dict is None: continue
290289

291-
if isinstance( last_dict, OrderedDict):
290+
if not isinstance( last_dict, list):
292291
# same as above
293292
last_ga = [last_dict]
294293
else:
@@ -309,3 +308,5 @@ def _parse_knxproject(filename, password=None):
309308
except Exception as e:
310309
print("Error {} occurred".format(e))
311310
return GAs
311+
312+

0 commit comments

Comments
 (0)