From 1f428866554b6ab8364e2501a249a590e4f0f65c Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sat, 27 Jun 2020 22:25:52 +0100 Subject: xml: T2660: do replace - with _ for defaults when not flattening --- python/vyos/xml/definition.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/python/vyos/xml/definition.py b/python/vyos/xml/definition.py index e493c54c1..5421007e0 100644 --- a/python/vyos/xml/definition.py +++ b/python/vyos/xml/definition.py @@ -11,8 +11,6 @@ # You should have received a copy of the GNU Lesser General Public License along with this library; # if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -from copy import deepcopy - from vyos.xml import kw # As we index by key, the name is first and then the data: @@ -253,7 +251,14 @@ class XML(dict): d = d[k] if not flat: - return deepcopy(d) + r = {} + for k in d: + under = k.replace('-','_') + if isinstance(d[k],dict): + r[under] = self.defaults(lpath + [k], flat) + continue + r[under] = d[k] + return r def _flatten(inside, index, d): r = {} -- cgit v1.2.3