From: Jeremy Stanley Date: Mon, 2 Jun 2014 06:31:26 +0000 (+0000) Subject: Don't unnecessarily recast lists and dicts X-Git-Tag: 0.0.1~237 X-Git-Url: https://mudpy.org/gitweb?a=commitdiff_plain;h=5c8dc88ec1007fe10891aecb8261cf5bd28b74e2;p=mudpy.git 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. --- 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