yleclanche wrote:
Hello,
Is it possible to call a macro in python ? This call should returns me the
html code generated.
Thanks.
Sure it is. You'll need an intermediary page template though. I call
mine macro_renderer.pt
<metal:block use-macro="here/global_defines/macros/defines" />
<div metal:use-macro="python:path('%s/macros/%s' % (thetemplate,
macro))" />
And you call it like this:
html = context.macro_renderer.pt_render(
extra_context = {'thetemplate':'context/page_template_with_macros',
'macro':'the_macro_i_want_to_call',
}
)
Any other variable you want to be in scope for the macro you'll have to
pass in the extra_content dictionary.
Hedley
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers