Hi,
I've been trying to do something similar to what Andrew was asking for:
<%!
def new_style_struct(name, is_inherited, gecko_name=None, additional_methods=None):
global THIS_STYLE_STRUCT
style_struct = StyleStruct(name, is_inherited, gecko_name, additional_methods)
STYLE_STRUCTS.append(style_struct)
THIS_STYLE_STRUCT = style_struct
return ""
%>
<%include file="foo.mako" args="helpers=self" />
I have tried adding the new_style_struct to the list of args, but it just won't work. Also, calling it like ${helpers.new_style_struct} (when having a <%page> tag to import it) doesn't work either.
How can you call compile-time-defined methods from a template being included? (%def methods _work_, but I'd rather not have to refactor the whole thing just to be able to extract parts of an overly large template into smaller helper files.)
Many thanks in advance. I've read the documentation, but just haven't gotten it working. Have also tried exposing globals=globals() or locals=locals() but it didn't help much either.
Best regards,
Per