#NEWLINE# @ register . filter #NEWLINE# def format_stack_trace( value ) : #NEWLINE# #INDENT# stack_trace = [ ] #NEWLINE# fmt = '<span class="path">{0}/</span><span class="file">{1}</span> in <span class="func">{3}</span>(<span class="lineno">{2}</span>) <span class="code">{4}</span>' #NEWLINE# for frame in value : #NEWLINE# #INDENT# params = map ( escape , ( frame [ 0 ] . rsplit ( '/' , 1 ) + list ( frame [ 1 : ] ) ) ) #NEWLINE# stack_trace . append ( fmt . format ( * frame ) ) #NEWLINE# #UNINDENT# return mark_safe ( '\n' . join ( stack_trace ) )