﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc
425,"Wish: <py:call lambda=""func"">FooBar</py:call> Resulting in func(stream) call",jacco@…,hodgestar,"Hi there,

I would like to post a wish for new genshi funcionality:

The idea is as follows:

In my XHTML template I would write:
{{{
 <py:call lambda=""func"">
   <h2>
     FooBar
   </h2>
 </py:call>
}}}
in python, for example:
{{{
#!python
 def func(stream):
     return tag.div(tag.p(""bogus""), stream, tag.p(""bogus"")).generate()
}}}
This would make the result of
{{{
>>  func(stream)
}}}
to replace the py:call tag.
So in this case resulting in the following html:
{{{
  <div>
    <p>bogus</p>
    <h2>
      Foobar
    </h2>
    <p>bogus</p>
  </div>
}}}
The advantage is that the argument of func can be any XHTML. The alternative way of doing this:
{{{
  ${func(tag.h2(""Foobar""))} 
}}}
is less readible and less flexible, since we suddenly have to use the tag() way of specifying HTML instead of using proper (X)HTML.

This solution would make very readable html templates. 
Of course the same thing could be implemented with match templates, but they are not in all cases the easiest and fastest and cleanest and most readable solutions. Furthermore py:call can be resolved while generate()ing and without extra match pass (as far as i understand how genshi works).


Of course the following should also work:
{{{
  <h2 py:call=""func"">
    FooBar
  </h2>
}}}

Where he result of func(stream) should be embedded in the h2 in this case yielding:
{{{
  <h2>
    <div>
      <p>bogus</p>
      Foobar
      <p>bogus</p>
    </div>
  <h2>
}}}

Thanks for your time.
Jacco Taal

",enhancement,new,major,0.9,Template processing,devel,,,
