[Twisted-web] validating nevow disk templates
L. Daniel Burr
ldanielburr at mac.com
Fri Feb 23 14:10:08 CST 2007
Hi Phil,
On Fri, 23 Feb 2007 13:50:09 -0600, Phil Mayers <p.mayers at imperial.ac.uk>
wrote:
> How do people do this?
>
> When I attempt to validate pages using the FireFox / Web Developer
> validator, I get a lot of complaints about tags that should be
> self-closed e.g.:
>
> <input type="text">
> <nevow:attr name="name"><nevow:slot name="name"/></nevow:attr>
> </input>
>
Generally, I try to avoid working to please markup validators, but that
may just be me ;)
> ...generates HTML like this:
>
> <input type="text" name="theName">
>
> </input>
>
> ...which is not only ugly, it doesn't validate.
>
A simple way to get around this is to eschew the cuter features of
nevow, and stick to plain-old render methods:
<input type="text" nevow:render="foo" />
In the render method, just grab the tag, twiddle its attributes in
whatever way best pleases you, and return it.
> I like stan, but I dislike the fact that it clutters up .py files and
> also that it doesn't reload like the disk templates. OTOH I deeply
> dislike the nevow:attr / nevow:slot pseudo-tags in the disk templates.
>
Sounds like you won't be happy either way ;) Fortunately, something
like what I suggested above should work for your stated case, and
allow you to steer between the Scylla of stan and the Charybdis of
nevow:attr.
Hope this helps,
L. Daniel Burr
More information about the Twisted-web
mailing list