#NEWLINE# def visit_Include( self , node , frame ) : #NEWLINE# #INDENT# 'Handles includes.' #NEWLINE# if node . with_context : #NEWLINE# #INDENT# self . unoptimize_scope ( frame ) #NEWLINE# #UNINDENT# if node . ignore_missing : #NEWLINE# #INDENT# self . writeline ( 'try:' ) #NEWLINE# self . indent ( ) #NEWLINE# #UNINDENT# func_name = 'get_or_select_template' #NEWLINE# if isinstance ( node . template , nodes . Const ) : #NEWLINE# #INDENT# if isinstance ( node . template . value , string_types ) : #NEWLINE# #INDENT# func_name = 'get_template' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( node . template . value , ( tuple , list ) ) : #NEWLINE# #INDENT# func_name = 'select_template' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( node . template , ( nodes . Tuple , nodes . List ) ) : #NEWLINE# #INDENT# func_name = 'select_template' #NEWLINE# #UNINDENT# #UNINDENT# self . writeline ( ( 'template = environment.%s(' % func_name ) , node ) #NEWLINE# self . visit ( node . template , frame ) #NEWLINE# self . write ( ( ', %r)' % self . name ) ) #NEWLINE# if node . ignore_missing : #NEWLINE# #INDENT# self . outdent ( ) #NEWLINE# self . writeline ( 'except TemplateNotFound:' ) #NEWLINE# self . indent ( ) #NEWLINE# self . writeline ( 'pass' ) #NEWLINE# self . outdent ( ) #NEWLINE# self . writeline ( 'else:' ) #NEWLINE# self . indent ( ) #NEWLINE# #UNINDENT# if node . with_context : #NEWLINE# #INDENT# self . writeline ( 'for event in template.root_render_func(template.new_context(context.parent, True, locals())):' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . writeline ( 'for event in template.module._body_stream:' ) #NEWLINE# #UNINDENT# self . indent ( ) #NEWLINE# self . simple_write ( 'event' , frame ) #NEWLINE# self . outdent ( ) #NEWLINE# if node . ignore_missing : #NEWLINE# #INDENT# self . outdent ( )