summaryrefslogtreecommitdiff
path: root/python/vyos/xml
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2020-06-23 17:51:06 +0700
committerGitHub <noreply@github.com>2020-06-23 17:51:06 +0700
commit70d45cdec4263a0eff1146656ae8e8012ab125b6 (patch)
tree2ac111a296189146f36d6c6be6f8dc63bb6ec936 /python/vyos/xml
parente76378f0d46bfd14f3716b3d0aa38435adf14f30 (diff)
parent06901b2b271a8aa7454dcaec2805e0858db38b92 (diff)
downloadvyos-1x-70d45cdec4263a0eff1146656ae8e8012ab125b6.tar.gz
vyos-1x-70d45cdec4263a0eff1146656ae8e8012ab125b6.zip
Merge pull request #471 from thomas-mangin/T2588-fix
xml: T2588: fix mistake when determining if a node is multi
Diffstat (limited to 'python/vyos/xml')
-rw-r--r--python/vyos/xml/definition.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/python/vyos/xml/definition.py b/python/vyos/xml/definition.py
index 1ecc2017a..c5f6b0fc7 100644
--- a/python/vyos/xml/definition.py
+++ b/python/vyos/xml/definition.py
@@ -251,20 +251,21 @@ class XML(dict):
d = d[k]
r = {}
- def _flatten(inside, d, r):
- prefix = '_'.join(_.replace('-','_') for _ in inside) + '_' if inside else ''
+ def _flatten(inside, index, d, r):
+ local = inside[index:]
+ prefix = '_'.join(_.replace('-','_') for _ in local) + '_' if local else ''
for k in d:
under = prefix + k.replace('-','_')
level = inside + [k]
if isinstance(d[k],dict):
- _flatten(level, d[k], r)
+ _flatten(level, index, d[k], r)
continue
if self.is_multi(level):
r[under] = [_.strip() for _ in d[k].split(',')]
continue
r[under] = d[k]
- _flatten([], d, r)
+ _flatten(lpath, len(lpath), d, r)
return r
# from functools import lru_cache