From 61278730c62223535ee609dc136f79b7c7fb0426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 13 Jul 2018 17:02:47 +0200 Subject: [PATCH] De-indent the code a bit --- pillar/api/nodes/__init__.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/pillar/api/nodes/__init__.py b/pillar/api/nodes/__init__.py index bf502b36..025ad464 100644 --- a/pillar/api/nodes/__init__.py +++ b/pillar/api/nodes/__init__.py @@ -417,17 +417,19 @@ def parse_markdown(node, original=None): def find_markdown_fields(schema, node): """Find and process all makrdown validated fields.""" for k, v in schema.items(): - if isinstance(v, dict): - if 'validator' in v and 'markdown' == v['validator']: - # If there is a match with the validator: markdown pair, assign the sibling - # property (following the naming convention __html) - # the processed value. - if k in node: - html = pillar.markdown.markdown(node[k]) - field_name = pillar.markdown.cache_field_name(k) - node[field_name] = html - if isinstance(node, dict) and k in node: - find_markdown_fields(v, node[k]) + if not isinstance(v, dict): + continue + + if v.get('validator') == 'markdown': + # If there is a match with the validator: markdown pair, assign the sibling + # property (following the naming convention __html) + # the processed value. + if k in node: + html = pillar.markdown.markdown(node[k]) + field_name = pillar.markdown.cache_field_name(k) + node[field_name] = html + if isinstance(node, dict) and k in node: + find_markdown_fields(v, node[k]) find_markdown_fields(schema, node)