Within our jinja templates we have a block of code that tries to create a span for the current user:
<span class="fa fa-user"></span> {{g.user.get_full_name()}}
However, if the user happens to clear the cookies on his browser, this g.user.get_full_name function will no longer exist, which causes the app to crash.
I don't necessarily want to reconstruct/preserve the g.user local proxy on cookie clear, but I at least want the app to handle it gracefully, maybe with a redirection to the login page. Is there any way to catch these exceptions for an arbitrary g.user.x reference?
You can use something like
or add the check on the back end and redirect when it is not present