<s> '''<STR_LIT>''' <EOL> from django import template <EOL> register = template . Library ( ) <EOL> def get_links ( trail ) : <EOL> ret = "<STR_LIT>" <EOL> for name , url in trail : <EOL> if ret : ret += '<STR_LIT>' <EOL> ret += '<STR_LIT>' % ( url , name ) <EOL> return ret <EOL> class BreadcrumbsNode ( template . Node ) : <EOL> def render ( self , context ) : <EOL> """<STR_LIT>""" <EOL> session = context [ "<STR_LIT>" ] . session <EOL> if "<STR_LIT>" in context : <EOL> trail = context [ "<STR_LIT>" ] <EOL> session [ "<STR_LIT>" ] = trail <EOL> else : <EOL> trail = session . setdefault ( "<STR_LIT>" , [ ] ) <EOL> return get_links ( trail ) <EOL> @ register . tag <EOL> def breadcrumbs ( parser , token ) : <EOL> try : <EOL> tag_name , = token . split_contents ( ) <EOL> except ValueError : <EOL> raise template . TemplateSyntaxError , "<STR_LIT>" % token . contents . split ( ) [ <NUM_LIT:0> ] <EOL> return BreadcrumbsNode ( ) </s>
