[REF]Hy base : use format strings, better setv
This commit is contained in:
parent
b8462951e0
commit
19b9fa6c69
@ -34,8 +34,9 @@
|
|||||||
(defmacro view-inherit [name model inherit &rest body]
|
(defmacro view-inherit [name model inherit &rest body]
|
||||||
"Inherited View simplification with name of the record, xmlid for model and
|
"Inherited View simplification with name of the record, xmlid for model and
|
||||||
inherited view"
|
inherited view"
|
||||||
(setv module (get (.split __name__ ".") 2))
|
(setv module (get (.split __name__ ".") 2)
|
||||||
(setv xmlid (+ (get (.split inherit ".") 1) "_inherit_" module))
|
inherited (get (.split inherit ".") 1)
|
||||||
|
xmlid f"{inherited}_inherit_{module}")
|
||||||
`(do
|
`(do
|
||||||
(view ~xmlid
|
(view ~xmlid
|
||||||
[(field-name ~name)
|
[(field-name ~name)
|
||||||
@ -53,7 +54,7 @@
|
|||||||
"Write XML file according to filename and given tree"
|
"Write XML file according to filename and given tree"
|
||||||
`(do
|
`(do
|
||||||
(import [os [path]])
|
(import [os [path]])
|
||||||
(setv elementtree ~tree)
|
(setv output-xml (.tostring ET tree)
|
||||||
(setv output (.tostring ET elementtree))
|
output-path (.dirname path (.abspath path __file__))
|
||||||
(setv fpath (+ (.dirname path (.abspath path __file__)) "/" ~filename))
|
fpath f"{output-path}/{filename}")
|
||||||
(with [f (open fpath "w")] (.write f output))))
|
(with [f (open fpath "w")] (.write f output-xml))))
|
||||||
|
Loading…
Reference in New Issue
Block a user