[Zope] Calling a ZPT macro, with parameters, from a python script

Dieter Maurer dieter at handshake.de
Thu Aug 30 15:20:05 EDT 2007


Sean F wrote at 2007-8-29 11:58 -0700:
>Is there a way to call a specific macro in a ZPT from a python script?
>
>So far, the only way I've found to do this is by calling the macro template
>from another template, then calling the wrapper, like:
>
>wrapper:
><metal:wrapper 
>      use-macro="python:path('here/my_macros/macros/'+options['macro'])" />
>
>script:
>context.my_wrapper(macro='my_macro',foo='whatever')
>
>Is there a way to do this without wrapping the macro template in another
>template call?

I doubt that you can do this in untrusted code.

To call a macro, the caller must provide some context (note
that a macro is usually used inside a template and this
template provides a namespace for variables and ways to handle
slots assignments). I would be very surprised if you could
build the context objects in untrusted code.



-- 
Dieter


More information about the Zope mailing list