#NEWLINE# @ register . function #NEWLINE# @ jinja2 . contextfunction #NEWLINE# def impala_breadcrumbs( context , items = list ( ) , add_default = True , crumb_size = 40 ) : #NEWLINE# #INDENT# "\n    show a list of breadcrumbs. If url is None, it won't be a link.\n    Accepts: [(url, label)]\n    " #NEWLINE# if add_default : #NEWLINE# #INDENT# base_title = page_name ( context [ 'request' ] . APP ) #NEWLINE# crumbs = [ ( urlresolvers . reverse ( 'home' ) , base_title ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# crumbs = [ ] #NEWLINE# #UNINDENT# if items : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# crumbs += items #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# crumbs . append ( items ) #NEWLINE# #UNINDENT# #UNINDENT# crumbs = [ ( url , truncate ( label , crumb_size ) ) for ( url , label ) in add_default ] #NEWLINE# c = { #NEWLINE# #INDENT# 'breadcrumbs' : crumbs , #NEWLINE# 'has_home' : add_default , #NEWLINE# #UNINDENT# } #NEWLINE# t = get_env ( ) . get_template ( 'amo/impala/breadcrumbs.html' ) . render ( c ) #NEWLINE# return jinja2 . Markup ( t )