From a227c1e942b5ff1f6f9c0df75d71f91a976a9d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Alix?= Date: Mon, 24 Oct 2022 12:47:54 +0200 Subject: [PATCH] [FIX] b_v_inheritance_extension: fix parsing of 'update' operation This fixes an error we could get if the attribute of the inherited tag has some extra carriage returns. Exception raised: SyntaxError: unexpected EOF while parsing --- base_view_inheritance_extension/models/ir_ui_view.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/base_view_inheritance_extension/models/ir_ui_view.py b/base_view_inheritance_extension/models/ir_ui_view.py index c04a3960b..e6ee174f2 100644 --- a/base_view_inheritance_extension/models/ir_ui_view.py +++ b/base_view_inheritance_extension/models/ir_ui_view.py @@ -112,7 +112,8 @@ class IrUiView(models.Model): for spec in specs: attr_name = spec.get("name") # Parse ast from both node and spec - source_ast = ast.parse(node.get(attr_name) or "{}", mode="eval").body + node_attr = (node.get(attr_name) or "{}").strip() + source_ast = ast.parse(node_attr, mode="eval").body update_ast = ast.parse(spec.text.strip(), mode="eval").body if not isinstance(source_ast, ast.Dict): raise TypeError(f"Attribute `{attr_name}` is not a dict")