<s> """<STR_LIT>""" <EOL> from django . shortcuts import redirect <EOL> from kitchen . backends . plugins import is_view <EOL> def inject ( node ) : <EOL> link = { <EOL> '<STR_LIT:url>' : "<STR_LIT>" . format ( node [ '<STR_LIT>' ] ) , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:title>' : '<STR_LIT>' , <EOL> } <EOL> node . setdefault ( '<STR_LIT>' , { } ) <EOL> node [ '<STR_LIT>' ] . setdefault ( '<STR_LIT:data>' , { } ) <EOL> node [ '<STR_LIT>' ] [ '<STR_LIT:data>' ] . setdefault ( '<STR_LIT>' , [ ] ) <EOL> node [ '<STR_LIT>' ] [ '<STR_LIT:data>' ] [ '<STR_LIT>' ] . append ( link ) <EOL> @ is_view ( '<STR_LIT:list>' ) <EOL> def links ( request , nodes ) : <EOL> try : <EOL> fqdn = request . GET [ '<STR_LIT>' ] <EOL> except KeyError : <EOL> return None <EOL> for node in nodes : <EOL> if fqdn == node [ '<STR_LIT>' ] : <EOL> try : <EOL> links = node [ '<STR_LIT>' ] [ '<STR_LIT:data>' ] [ '<STR_LIT>' ] <EOL> except KeyError : <EOL> return None <EOL> for link in links : <EOL> print link <EOL> if link . get ( '<STR_LIT:title>' ) == '<STR_LIT>' : <EOL> return redirect ( link [ '<STR_LIT:url>' ] ) <EOL> else : <EOL> return None </s>
