[Twisted-web] How to render an empty stan tag in Nevow

Pedro Sanchez psanchez at nortel.com
Tue Sep 27 15:27:56 MDT 2005


Hello,

I have a situation like this:

class myPage(rend.Page):

    def render_salute(self, context, data):
	rv = <something-I-don't-know>
        if <condition>:
           rv = loaders.stan(T.p['You made it'])
        return rv

    docFactory = loaders.stan(
	....
	T.invisible(render=T.directive('salute'))
        ....

What I want in render_salute is to return 'nothing' if <condition> is
false. Basically, as if the T.invisible in the docFactory didn't exist.
I've tried
  <something-I-don't-know> = loaders.stan(T.p[''])
but it has the side effect of forcing a line break which is undesirable
(in my real code the T.invisible is inside a table cell). Even returning
a &nbsp; string would do it! 

Any suggestions?

Thanks,

-- 
Pedro





More information about the Twisted-web mailing list