[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]
|
||||
"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))))
|
||||
|
Loading…
Reference in New Issue
Block a user