I think there is sth wrong with your installation or sth else. It
works for my Pylons app w/o problems.

I also can have nested defs/calls. I do use namespaces...

My working examples: with Mako:
<%def name="field(name)">
    <tr>
        <td style="white-space:nowrap;width:1%;">
            ${name}
        </td>
        <td style="white-space:nowrap;width:98%;">
            ${caller.body()}
        </td>
    </tr>
</%def>

 <%call expr="field('First (Given) Name')">
            <input class="form-text validator-required"
                   id="first_name" name="first_name"
                   title="First (Given) Name" type="text"
                   value="${c.first_name}"/>
 </%call>


Output:
 <tr>
        <td style="white-space:nowrap;width:1%;">
            First (Given) Name
        </td>
        <td style="white-space:nowrap;width:98%;">

            <input class="form-text validator-required"
                   id="first_name" name="first_name"
                   title="First (Given) Name" type="text"
                   value=""/>

        </td>
    </tr>


On 9/17/07, wolf <[EMAIL PROTECTED]> wrote:
>
>
> hi all,
>
> today i tried to `<%def>`s and `<%namespace>`s in mako under pylons,
> and it so happened i found that the minimal example from the mako
> docs,
>
>   <%def name="buildtable()" buffered="True">
>       <table>
>           <tr><td>
>               ${caller.body()}
>           </td></tr>
>       </table>
>   </%def>
>
>   <%call expr="buildtable()">
>       I am the table body.
>   </%call>
>
> does not work inside a mako template rendered by pylons (nit: the
> actual code at
> http://www.makotemplates.org/docs/defs.html#defs_defswithcontent
> lacks the parentheses in the `<%call>` tag).
>
> turns out it's possible to have a reference to `caller.body()` under
> said circumstances *only* after saying   `<
> %caller=context.get('caller')%>` in the function definition, so under
> pylons the example becomes
>
>   <%def name="buildtable()" buffered="True">
>       <%caller=context.get('caller')%>
>       <table>
>           <tr><td>
>               ${caller.body()}
>           </td></tr>
>       </table>
>   </%def>
>
>   <%call expr="buildtable()">
>       I am the table body.
>   </%call>
>
> it would just be great if this detail could make it into the docs.
> guess it was pure luck that i found the solution so quickly. or did i
> make some stupid mistake? i didn't find any postings concerned with
> exactly this problem, but someone should have been bitten by it
> earlier, no?
>
> _wolf
>
>
> >
>


-- 
  _i______'simplicity_is_the_key'__________tomasz_nazar
_ii____'i_am_concern_oriented'________________JKM-UPR
_iii__'patsystem.sf.net'___________________linux_user
_'aspectized.com'___________________________prevayler

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to