Skip variables that do not exist


I wonder if it is possible to make relatorio continue with filling a template, even if a variable that does not exist is accessed.

Right now, an error is thrown, but I would like to finish the template instead. It would be great, if a standard text like “not defined” could be added.

Best regards,

Relatorio is based on Genshi and I do not think this is allowed (and I think it is a good thing).
You can probably explicitly test if a variable exists in globals() before using it.


the getattr-example in my post about check if variable exists could be helpful for you.

Hi udono,

thank you!