[Zope] Accessing a macro slot from Python

Bryn Thomas brynthomas at red24.info
Mon Oct 18 19:17:14 EDT 2004


Dear all,

I'm trying to get a Zope Page Template to use a macro which is passed a few
parameters that need to be accessed by Python. I was under the impression
that "define-slot" and "fill-slot" where the appropriate ways of passing
parameters, but I'm really struggling to use these slots from within Python
expressions in the macro.

My macro looks like so:

<span metal:define-macro="pullActivityReport">
	<tr tal:repeat="update
python:container.get_updates_made(templateid=MYTEMPLATEIDSLOT)">
		<td><span tal:replace="update/topicname">Topic
Name</span></td>
	</tr>
</span>	

While my main page looks like:

<table>
    <span metal:use-macro="container/macroDefs/macros/pullActivityReport">
	<span metal:fill-slot="MYTEMPLATEIDSLOT">22</span>
    </span>
</table>

Is such an amazing feat possible? I am currently using "tal:define global"
to pass parameters but it seems like a less than desirable solution (global
scope, etc...)

Regards,
Bryn





More information about the Zope mailing list