[Twisted-web] Nevow Templating question

jonathan vanasco jvanasco at mastersofbranding.com
Mon Apr 12 22:43:09 MDT 2004


This works, but I think the approach might be wrong.
(the output is what I want it to be, but I think I may have implemented 
things counter to the way nevow was designed)

Can someone please offer their input?



template.html
-------------------
<tr>
	<td valign="top"> pick a city</td>
	<td>
		<select name="city">
		<span nevow:data="citiesList" nevow:render="city"></span>
		</select>
	</td>
</tr>


testing.py
-------------------
	def data_citiesList(self, context, data):
		return {"New York":'1', "Los Angeles":'2'}
	def render_city(self, context, data):
		"""Example of using stan to render a page.
		"""
		return rend.stan(
			[
				T.option(value=v)[k] for (k,v) in data.items()
			]
		)

Output.html
----------------
<tr>
	<td valign="top"> pick a city</td>
	<td>
		<select name="city">
			<option value=1>New York</option>
			<option value=2>Los Angeles</option>
		</select>
	</td>
</tr>




More information about the Twisted-web mailing list