From 19b9fa6c692094f4accc5fc96dc5788f989dfb62 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Mon, 16 Sep 2019 18:10:37 +0200 Subject: [PATCH] [REF]Hy base : use format strings, better setv --- hy_base/odoo.hy | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hy_base/odoo.hy b/hy_base/odoo.hy index f2aa17e..b6e2009 100644 --- a/hy_base/odoo.hy +++ b/hy_base/odoo.hy @@ -34,8 +34,9 @@ (defmacro view-inherit [name model inherit &rest body] "Inherited View simplification with name of the record, xmlid for model and inherited view" - (setv module (get (.split __name__ ".") 2)) - (setv xmlid (+ (get (.split inherit ".") 1) "_inherit_" module)) + (setv module (get (.split __name__ ".") 2) + inherited (get (.split inherit ".") 1) + xmlid f"{inherited}_inherit_{module}") `(do (view ~xmlid [(field-name ~name) @@ -53,7 +54,7 @@ "Write XML file according to filename and given tree" `(do (import [os [path]]) - (setv elementtree ~tree) - (setv output (.tostring ET elementtree)) - (setv fpath (+ (.dirname path (.abspath path __file__)) "/" ~filename)) - (with [f (open fpath "w")] (.write f output)))) + (setv output-xml (.tostring ET tree) + output-path (.dirname path (.abspath path __file__)) + fpath f"{output-path}/{filename}") + (with [f (open fpath "w")] (.write f output-xml))))