[Zope] squirting variable definitions into macros using fill-slot

Felix Ulrich-Oltean felix@chaptereight.com
05 Mar 2003 17:06:10 +0000


I have a macro like this:

<metal:block define-macro="conf_form">
  <div class="something"
       tal:define="chosen_thing request/chosen_thing|here/chosen_thing;
                   the_name     request/the_name|here/the_name">

    <input type="radio"
           tal:attributes="name the_name;
                           checked python:chosen_thing=='a' or nothing;"
           value="a" /> a <br />
    <input type="radio"
           tal:attributes="name the_name
                           checked python:chosen_thing=='b' or nothing;"
           value="b" /> b <br />
  </div>
</metal:block>

I will be using it several times from the same template.  I want to be
able to pass in values for chosen_thing and the_name, but I can't
think how.

If I define a slot, e.g. for the <div>, the stuff in fill-slot will
replace all the stuff in the macro.  Alternatively, I could use
fill-slot and a 'global' definition, but then I wouldn't be able to
use it more than once.

Am I just being dumb here?  It must be possible to pass in dynamic
information using fill-slot.

Thanks for any advice,

Felix.