You can use tal:on-error to substitute content in case there's a NameError. There's a couple other ideas/suggestions on this question on stack overflow:
http://stackoverflow.com/questions/8854179/chameleon-zpt-templates I've tried using tal:one-error and it seems to work if your only using the variable to fill the content of an element. Haven't used it for anything more advanced than that though. On Wednesday, May 9, 2012 11:09:21 AM UTC-7, Theron Luhn wrote: > > I'm using Chameleon :\ > > On Tuesday, May 8, 2012 9:51:00 PM UTC-7, Robert Forkel wrote: >> >> If you are using mako, you may want to have a look at >> http://docs.makotemplates.org/en/latest/runtime.html#context-variables >> and adapt the strict_undefined setting in your config. >> regards >> robert >> >> On Wed, May 9, 2012 at 6:27 AM, Theron Luhn <[email protected]> wrote: >> > I can pass variables into my template by returning them in a dictionary >> from >> > the view controller. However, if I try to access a variable from the >> > template that I didn't pass, I'll get an error. Is it possible to have >> a >> > default value so I don't get an error? Maybe with BeforeRender or >> something? >> > >> > - Theron >> > >> > -- >> > 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 view this discussion on the web visit https://groups.google.com/d/msg/pylons-discuss/-/eEsTPTZJTpcJ. 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.
