How do you debug Mako templates?

后端 未结 6 1776
星月不相逢
星月不相逢 2021-01-30 21:15

So far I\'ve found it impossible to produce usable tracebacks when Mako templates aren\'t coded correctly.

Is there any way to debug templates besides iterating for ever

6条回答
  •  独厮守ぢ
    2021-01-30 21:55

    Mako actually provides a VERY nice way to track down errors in a template:

    from mako import exceptions
    
    try:
        template = lookup.get_template(uri)
        print template.render()
    except:
        print exceptions.html_error_template().render()
    

提交回复
热议问题