Re: [Rest2web-develop] How to use custom macro in template files ?
Brought to you by:
mjfoord
From: David C. <da...@ar...> - 2007-01-31 08:21:10
|
David Cournapeau wrote: > Michael Foord wrote: >> David Cournapeau wrote: >>> Hi there, >>> >>> I am using rest2web for my own website, and it is working great, but >>> I have one problem. I would like to use my own python functions in the >>> templates, and I don't know how to do that. I manage to use my macro in >>> a index file doing {print_hello}, but I cannot make it work in a >>> template.txt (using <# print_hello() #>). >> This should work. You should either import or define the function in the >> template. > What do you mean by import ? The problem really seems to be related to > being able to add my function in the "template's namespace". Ok, the solution is so obvious I feel a bit embarassed... I just have to import the module where the macro are defined; it is just standard python. David |