[Twisted-web] rendering patterns with different data types
Federico Tomassini
federicotom at yahoo.it
Mon Feb 4 13:05:07 EST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I have to understand how renderers, slots and patterns work.
I try to read examples and tutorials, but doubts remain: above all I'm
a newbye.
Suppose I have an item such that (values to be rendered are uppercased):
<li>
<input type="text" value="INPUT_VALUE"/>
<select name="foo">
...
<option>OPTION_VALUES</option>
...
</select>
<textarea name="bar">TEXT_VALUE</textarea>
</li>
Now, this item has to be repeated N times. To do that, I have a python
list, each element such that:
{
'INPUT_VALUE: 'foo',
'OPTION_VALUES': ['a', 'list', 'of', 'strings'],
'TEXT_VALUE': "bar"
}
ie a list of dicts.
It would be nice to use nevow:data="my_list", nevow:render="mapping"
and nevow:slots.
Maybe this is the wrong way, because I cannot find how. The questions:
1- If with
<textarea nome="bar">
<nevow:slot name="TEXT_VALUE"/>
</textarea>
I can correctly fill the textarea, how can I correctly fill
the INPUT_VALUE? It is inside the input tag options, not inside
the input tag contents.
2- What about the OPTION_VALUES? Is it possible to "subpattern" a
pattern? If yes, how?
Finally, I'm wondering if this is the correct way to render such item or
if a better, more elegant, solution, exists.
thanks
br
- --
efphe
Today is Setting Orange, the 35th day of Chaos in the YOLD 3174
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
iD8DBQFHp1PTi7obm7aBjHcRArv2AJ992+SkWwfKCmAVrQQQFTjJiOrYfwCfdSQG
i0ih5b89cMcQYHzxx4KvGeI=
=4tvV
-----END PGP SIGNATURE-----
More information about the Twisted-web
mailing list