tags:

views:

21

answers:

1

Is there a way to add tempate string which contains error to mako`s error trace?

+1  A: 

I don't think you're likely to find such a thing. Like all the other fast python template engines, Mako achieves its speed by compiling your template into python code and then executing it. An exception will divert execution out of your template's code, so by the time one is raised, that template will have no way of displaying it (or doing anything else for that matter).

As an alternative, I suggest putting your template rendering code inside a try block, and rendering any caught exceptions with a separate template used specifically for that purpose.

Forest