From 290e6cf8823a751a7c71a1cd77eb16d27374a8e0 Mon Sep 17 00:00:00 2001 From: Michael Graf Date: Wed, 12 Jun 2019 09:33:43 +0200 Subject: [PATCH] prepare for callable data-attributes, bluedynamics/yafowil.plone#26, this commit needs bf84c53e5e3ace6d824a98fe4b4c3a1a19a5369f --- src/yafowil/yaml/parser.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/yafowil/yaml/parser.py b/src/yafowil/yaml/parser.py index 73dc8cc..8e8e2c1 100644 --- a/src/yafowil/yaml/parser.py +++ b/src/yafowil/yaml/parser.py @@ -98,7 +98,15 @@ def create_tree(self, data): def call_factory(defs): props = dict() for k, v in defs.get('props', dict()).items(): - props[k] = self.parse_definition_value(v) + if isinstance(v, dict): + dict_attrs = list() + for vk, vv in v.items(): + val = self.parse_definition_value(vv) + part = [vk, val] + dict_attrs.append(part) + props[k] = dict_attrs + else: + props[k] = self.parse_definition_value(v) custom = dict() for custom_key, custom_value in defs.get('custom', dict()).items(): custom_props = list()