[Twisted-web] How to fill slots in sub-pattern
Paul Reznicek
maillists at ivsn.com
Sat Mar 18 10:29:18 CST 2006
Hi all,
I've one page template and would like to use different pattern in different
Page subclasses.
A snipped of the template:
# ----------------------------------------------
<td class="main">
<n:invisible n:render="contentMain" n:data="contentData">
<table n:pattern="contentTable" n:render="sequence">
<tr n:pattern="header">
<th id="firstHeader">First Column</th>
<th id="secondHeader">Second Column</th></tr>
<tr n:pattern="item" n:render="row">
<td><n:slot name="first_column" />data1</td>
<td><n:slot name="second_column" />data2</td>
</tr>
</table>
<table n:pattern="otherTableData" n:render="sequence">
<tr n:pattern="header">
<th id="firstHeader">Col 1</th>
<th id="secondHeader">Col 2</th></tr>
<th id="thirdHeader">Col 3</th></tr>
<tr n:pattern="item" n:render="row">
<td><n:slot name="first_column" />data1</td>
<td><n:slot name="second_column" />data2</td>
<td><n:slot name="third_column" />data3</td>
</tr>
</table>
</n:invisible>
</td>
# ----------------------------------------------
The renderer should work like this:
# ----------------------------------------------
def render_contentMain(self, ctx, data):
patternHere = inevow.IQ(ctx).onePattern('contentTable')
patternHere.fillSlots('first_column', data[0])
patternHere.fillSlots('second_column', data[1])
return patternHere.tag
# ----------------------------------------------
But this does not work ...
Can somebody help me?
Thanks in advance,
Paul
More information about the Twisted-web
mailing list