views:

34

answers:

0

How can I make my own function to use in all the Mako templates?

For example, I want to create function boda(a, b) that will return a + b. (Toy example.)

How can I do this?

One way I know that I can do it in template itself:

<%
  def boda(a, b): return a + b
%>

But I want this function to be globally available to all the templates, so I don't have to redefine it every time!

Thanks, Boda Cydo.