summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-06-23 11:49:34 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-06-23 11:49:34 +0100
commit06901b2b271a8aa7454dcaec2805e0858db38b92 (patch)
tree2ac111a296189146f36d6c6be6f8dc63bb6ec936 /python
parente76378f0d46bfd14f3716b3d0aa38435adf14f30 (diff)
downloadvyos-1x-06901b2b271a8aa7454dcaec2805e0858db38b92.tar.gz
vyos-1x-06901b2b271a8aa7454dcaec2805e0858db38b92.zip
xml: T2588: fix mistake when determining if a node is multi
Diffstat (limited to 'python')
-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