#NEWLINE# def new_context( environment , template_name , blocks , vars = None , shared = None , globals = None , locals = None ) : #NEWLINE# #INDENT# 'Internal helper to for context creation.' #NEWLINE# if ( vars is None ) : #NEWLINE# #INDENT# vars = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if shared : #NEWLINE# #INDENT# parent = vars #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# parent = dict ( ( globals or ( ) ) , ** vars ) #NEWLINE# #UNINDENT# if locals : #NEWLINE# #INDENT# if shared : #NEWLINE# #INDENT# parent = dict ( parent ) #NEWLINE# #UNINDENT# for ( key , value ) in locals . iteritems ( ) : #NEWLINE# #INDENT# if ( ( key [ : 2 ] == 'l_' ) and ( value is not missing ) ) : #NEWLINE# #INDENT# parent [ key [ 2 : ] ] = value #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return Context ( environment , parent , vars , blocks )