From 5c8dc88ec1007fe10891aecb8261cf5bd28b74e2 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Mon, 2 Jun 2014 06:31:26 +0000 Subject: [PATCH] Don't unnecessarily recast lists and dicts * lib/mudpy/misc.py(Element.getlist,Element.getdict): Unlike INI, YAML directly encodes other datatypes in addition to strings. When using get functions for lists and dicts, if they're already provided in their desired form then don't recast them as doing so would instead create nested datatypes instead. --- lib/mudpy/misc.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/mudpy/misc.py b/lib/mudpy/misc.py index 84d1a5e..c6fd97d 100644 --- a/lib/mudpy/misc.py +++ b/lib/mudpy/misc.py @@ -224,7 +224,10 @@ class Element: default = [] value = self.get(facet) if value: - return mudpy.data.makelist(value) + if type(value) is list: + return value + else: + return mudpy.data.makelist(value) else: return default @@ -234,7 +237,10 @@ class Element: default = {} value = self.get(facet) if value: - return mudpy.data.makedict(value) + if type(value) is dict: + return value + else: + return mudpy.data.makedict(value) else: return default -- 2.11.0