[Twisted-web] How to render an empty stan tag in Nevow
matt at pollenation.net
Tue Sep 27 16:13:23 MDT 2005
Pedro Sanchez wrote:
>I have a situation like this:
> 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(
>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.
> <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 string would do it!
Semantically, "return None" is better but the Big Red None is such a
useful debugging aid that returning the emptry string is used to
indicate HTML nothingness.
More information about the Twisted-web