#NEWLINE# def get_template_exception_info( self ) : #NEWLINE# #INDENT# ( origin , ( start , end ) ) = self . exc_value . source #NEWLINE# template_source = origin . reload ( ) #NEWLINE# context_lines = 10 #NEWLINE# line = 0 #NEWLINE# upto = 0 #NEWLINE# source_lines = [ ] #NEWLINE# before = during = after = '' #NEWLINE# for ( num , next ) in enumerate ( linebreak_iter ( template_source ) ) : #NEWLINE# #INDENT# if ( ( start >= upto ) and ( end <= next ) ) : #NEWLINE# #INDENT# line = num #NEWLINE# before = escape ( template_source [ upto : start ] ) #NEWLINE# during = escape ( template_source [ start : end ] ) #NEWLINE# after = escape ( template_source [ end : next ] ) #NEWLINE# #UNINDENT# source_lines . append ( ( num , escape ( template_source [ upto : next ] ) ) ) #NEWLINE# upto = next #NEWLINE# #UNINDENT# total = len ( source_lines ) #NEWLINE# top = max ( 1 , ( line - context_lines ) ) #NEWLINE# bottom = min ( total , ( ( line + 1 ) + context_lines ) ) #NEWLINE# self . template_info = { #NEWLINE# #INDENT# 'message' : self . exc_value . args [ 0 ] , #NEWLINE# 'source_lines' : source_lines [ top : bottom ] , #NEWLINE# 'before' : before , #NEWLINE# 'during' : during , #NEWLINE# 'after' : after , #NEWLINE# 'top' : top , #NEWLINE# 'bottom' : bottom , #NEWLINE# 'total' : total , #NEWLINE# 'line' : line , #NEWLINE# 'name' : after . name , #NEWLINE# #UNINDENT# }