{{if 'page_headings' in globals():}}
{{=page_headings}}
{{else:}}
My default
{{pass}}
On Oct 14, 1:34 am, Joe J <[email protected]> wrote:
> Hi All,
>
> I have a quick question regarding the behavior of variables in view
> code. I'm my "upper level" layout, I'd like to define a variable
> called page_heading. If the controller passes a page_heading variable
> in it's dictionary to the view, I'd like it to display the contents of
> that variable. Otherwise, I'd like the variable to display a default
> value. However, when I try something like below, I get a "Exception:
> <type 'exceptions.NameError'>(name 'page_heading' is not defined)".
>
> I would prefer not to have to explicitly define this variable in every
> single controller. Is there way to get this page_heading variable to
> display if passed, but accept a default value if not?
>
> {{=page_heading or 'My Default'}}
>
> Thanks for any advice.
> Joe