Thanks, I was hoping for something like that. I missed that in the docs.
Mark On Oct 30, 2011, at 4:49 AM, Malthe Borch wrote: > Try using "exists:". > > http://pagetemplates.org/docs/latest/reference.html#types > > E.g. > > <div tal:condition="exists: some_callable"> > ... > > \malthe > > On 29 October 2011 15:34, Mark Erbaugh <[email protected]> wrote: >> Is there a way in a tal:condition test to test if a given variable has been >> defined? For example, if my view callable has not defined a variable in the >> response object, can I use a tal:condition to exclude a section of the >> template that depends on that variable being defined? >> >> Here's what I'm trying to do. I have a template that provides the bulk >> layout of each page. It's used as a macro that each individual page >> includes. As part of the macro, I'd like to have a section that is included >> only if the individual page defines a variable. tal:condition seems to >> require that the variable be defined and have a False value. One approach I >> thought of, but couldn't seem to get working was to define the variable to >> nothing in the macro (tal:define="variable nothing") and have the client >> view re-define it, but I must not understand scope or something as the >> client definition of the variable didn't seem to replace the tal:define >> value. >> >> Mark >> >> -- >> You received this message because you are subscribed to the Google Groups >> "pylons-discuss" 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/pylons-discuss?hl=en. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" 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/pylons-discuss?hl=en. > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en.
