[Twisted-web] patch: default values for slots from html templates
tv at twistedmatrix.com
Thu Mar 3 13:40:44 MST 2005
Stefano Debenedetti wrote:
> But I like more the syntax suggested by srid for specifying the default:
> + more similar to what other popular templating languages do, XSLT for
> one but also some java-based I think
> + makes templates more useful when looked at in a browser by themselves
> (w/o nevow rendering), when testing the l'n'f
The problem with that is that a lot of existing templates already use
<n:slot name="foo">Stuff for the web monkey to see</n:slot>, and you
certainly don't want that to be the default.
Also, I'd imagine it's a valid use case to want to see some "example
data" in the template, when viewed directly, and still set the default
to something else.
<n:slot name="fullname" default="MISSING">John Doe</n:slot>
The biggest downside with the default="foo" syntax is its inability
to do non-strings.
Taking all of the above into consideration, I'd suggest something like
and possibly also allow the default="MISSING", to make simple case
More information about the Twisted-web