[Twisted-web] Sub-tag level templating in Nevow: possible?
Mary Gardiner
mary-twisted at puzzling.org
Sun Oct 10 13:44:45 MDT 2004
I have a use-case for sub-tag level templating in Nevow.
Imagine that for some reason I have a list of categories that I want to
link to. I might want to link to them like this:
<a href="catname1">catname1</a>
<a href="catname2">catname2</a>
<a href="catname3">catname3</a>
Or I might want to link to them like this:
<a href="catname1">Category catname1</a>
<a href="catname2">Category catname2</a>
<a href="catname3">Category catname3</a>
As best I can tell, the only way to do this is by changing a render_
method to be either:
render_atag(self, ctx, data):
return ctx.tag(href=data)[data]
or
render_atag(self, ctx, data):
return ctx.tag(href=data)["Category: " + data]
I'd prefer to specify it in an HTML template rather than the Python code for
various reasons (for starters, it isn't "business logic", it's a design
choice). Is there any way to do that?
-Mary
More information about the Twisted-web
mailing list