Sanjay schrieb:
> Hi All,
>
> I am using TG 1.0.2.2. Several places in my Genshi templating code, I
> am using
>
> <py:if test="foo">
>
> If foo is not defined, it returns None i.e. False.
>
> Now that I upgrade to TG 1.0.3.2, I get the error: UndefinedError:
> ('"foo" not defined'...
>
> Refering to Genshi documentations here ->
> http://genshi.edgewall.org/wiki/Documentation/templates.html#built-in-functions-types
>
> I changed the code to
>
> <py:if test="defined(foo)">
>
> But still I get the same error.
>
> Needing help on how to solve it.
Well, its pretty obvious that if
foo
isn't defined, an expression containing foo will also fail to execute. So
defined(foo)
is unlikely to work. But if you read the documentation of your link
above carefully, you will see that defined takes a NAME of variable. Not
the (non-defined) variable itself!
So
<py:if test="defined('foo')">
should do the trick.
Diez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---