[ZPT] Need help understanding TAL and METAL:fill-lots interaction

Stephen Nesbitt snesbitt at cobaltgroup.com
Mon Aug 23 19:14:28 EDT 2004


All:

I'm probably missing something obvious, but how can I reference a 
tal variable inside of a metal:fill-slot element? For example:

<div tal:define="projectName python:lookupName()" >
  <h1 metal:fill-slot="header" tal:content="projectName">
     Project Name
  </h1>
  <div metal:fill-slot="main">
     <h2 tal:attributes="id projectName">
        Project Name
    </h2>
  </div>
</div>

returns a key error on projectName.

Essentially what I have here is an expensive operation to determine 
the projectName which is then used to fill information in several 
slots. However, this doesn't seem to work - if defined on a 
containing element, rather than the element itself, the variable 
isn't recognized - I get a key error on projectName.

If I define projectName on the element itself -
<div tal:define="projectName python:lookupName()"
       metal:fill-slot="base" >
it works, but forces me to make an expensive call twice.


I suspect that there is some issue with how things are processed, 
but am not sure what to do about it.

Thanks in advance.

-steve
-- 

Stephen Nesbitt
Senior Configuration Management Engineer
The Cobalt Group
206.219.8271
snesbitt at cobaltgroup.com


More information about the ZPT mailing list