[Twisted-web] patch: default values for slots from html templates

James Y Knight foom at fuhm.net
Thu Mar 3 14:48:47 MST 2005


On Mar 3, 2005, at 3:40 PM, Tommi Virtanen wrote:
> 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.

If that's a requirement, I don't think your proposed syntax will do it, 
because the webmonkey will see both MISSING *and* John Doe. If that's 
not a requirement (and I personally don't think it needs to be, but as 
I don't do much webmonkeying, could be convinced otherwise), a much 
simpler solution is to do <n:slot name="fullname" 
allowDefault="true">MISSING</n:slot>. That also has the advantage of 
not breaking any current code and allowing arbitrary default contents.

James




More information about the Twisted-web mailing list