CherryPy is the request router -- it's responsible for cracking open the HTTP message and deciding how to process it. I have a few nits about it -- mainly documentation related -- but getting a webserver set up which did something along the lines of, "Route everything through Genshi except this path, which you should serve from the filesystem," was very straightforward.
Genshi is the first page framework which evoked a response from me of, "Hm, this could work," instead of, "God, I feel like I'm going to throw up." It uses an interesting approach: you write everything in XML and embed the programmatic constructs in the attributes. The rendering phase takes care of the transformation to HTML (or text, or
<tr py:for="param in parameters">
<td py:if="param.valueType in ('int', 'float')">
<div dojoType="dijit.form.HorizontalSlider"
id="${param.name}Slider"
py:attrs="param.sliderAttributes"
intermediateChanges="true"
onChange="onNumericSliderChange('${name}')" />
</td>
</tr>
I'm used to the frameworks which require you to escape any code. Genshi lets you do that, if you absolutely insist upon it:
<?python
for param in parameters:
?><tr><?python
if param.valuetype in ('int', 'float'):
?><div dojoType="dijit.form.HorizontalSlider"
id="${param.name}Slider"
py:attrs="param.sliderAttributes"
intermediateChanges="true"
onChange="onNumericSliderChange('${name}')" />
</td>
</tr>
Dojo is a set of widgets. Not quite Google Web Toolkit, but it's simple and gets the job done.
1 comment:
I probably should have commented on this post earlier, but I wanted to comment that the "code bits are represented by special tags" paradigm is (a) absolutely the right way to do things if you can possibly manage it and (b) something that I first ran into in the Apache Struts framework, which defines a huge number of custom JSP tags to handle all that.
Post a Comment