[Zope] Filling a metal slot which name is known only at run time

Martin Aspeli optilude at gmx.net
Sun Dec 12 17:24:59 EST 2004


Hi,

I am writing a kind of generic templating system. The details are not so  
important, but essentially, I need developers to be able to write page  
templates with slots, which end users can fill with various content via a  
tool I'm writing. Basically, I need to be able to get the list of all  
slots in a macro (which I can by traversing the contents of  
'template.macros') and then to generate a metal:fill-slot statement for  
each one.

However, the problem is that metal:fill-slot seems only to accept a static  
string as the slot name. I need to be able to generate the fill-slot  
statement at run-time, essentially something like:

	metal:fill-slot="python:here.getSlotToFill ()"

though that doesn't work, because it doesn't evaulate the python:  
statement, taking it instead as a string (which is an invalid slot name).

Can this be done?

Thanks,

Mart

-- 
"Life is both a major and a minor key" -- Travis, Side



More information about the Zope mailing list