def validate_template(html):
 import frappe
 from jinja2 import TemplateSyntaxError
 jenv = get_jenv()
 try:
  jenv.from_string(html)
 except TemplateSyntaxError as e:
  frappe.msgprint(u'Line {}: {}'.format(e.lineno, e.message))
  frappe.throw(frappe._(u'Syntax error in template'))

def validate_template ( html ) : import frappe from jinja2 import TemplateSyntaxError jenv = get_jenv ( ) try : jenv . from_string ( html ) except TemplateSyntaxError as e : frappe . msgprint ( u'Line {}: {}' . format ( e . lineno , e . message ) ) frappe . throw ( frappe . _ ( u'Syntax error in template' ) )
throws exception if there is a syntax error in the jinja template .