capybara/virtualenv/lib/python2.7/site-packages/jinja2/compiler.py
def visit_Include(self, node, frame):
        """Handles includes."""
        if node.with_context:
            self.unoptimize_scope(frame)
        if node.ignore_missing:
            self.writeline('try:')
            self.indent()

        func_name = 'get_or_select_template'
        if isinstance(node.template, nodes.Const):
            if isinstance(node.template.value, string_types):
                func_name = 'get_template'
            elif isinstance(node.template.value, (tuple, list)):
                func_name = 'select_template'
        elif isinstance(node.template, (nodes.Tuple, nodes.List)):
            func_name = 'select_template'

        self.writeline('template = environment.%s(' % func_name, node)
        self.visit(node.template, frame)
        self.write(', %r)' % self.name)
        if node.ignore_missing:
            self.outdent()
            self.writeline('except TemplateNotFound:')
            self.indent()
            self.writeline('pass')
            self.outdent()
            self.writeline('else:')
            self.indent()

        if node.with_context:
            self.writeline('for event in template.root_render_func('
                           'template.new_context(context.parent, True, '
                           'locals())):')
        else:
            self.writeline('for event in template.module._body_stream:')

        self.indent()
        self.simple_write('event', frame)
        self.outdent()

        if node.ignore_missing:
            self.outdent()
def visit_Include(self, node, frame):
        """Handles includes."""
        if node.with_context:
            self.unoptimize_scope(frame)
        if node.ignore_missing:
            self.writeline('try:')
            self.indent()

        func_name = 'get_or_select_template'
        if isinstance(node.template, nodes.Const):
            if isinstance(node.template.value, string_types):
                func_name = 'get_template'
            elif isinstance(node.template.value, (tuple, list)):
                func_name = 'select_template'
        elif isinstance(node.template, (nodes.Tuple, nodes.List)):
            func_name = 'select_template'

        self.writeline('template = environment.%s(' % func_name, node)
        self.visit(node.template, frame)
        self.write(', %r)' % self.name)
        if node.ignore_missing:
            self.outdent()
            self.writeline('except TemplateNotFound:')
            self.indent()
            self.writeline('pass')
            self.outdent()
            self.writeline('else:')
            self.indent()

        if node.with_context:
            self.writeline('for event in template.root_render_func('
                           'template.new_context(context.parent, True, '
                           'locals())):')
        else:
            self.writeline('for event in template.module._body_stream:')

        self.indent()
        self.simple_write('event', frame)
        self.outdent()

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