当前位置: 首页>>代码示例>>Python>>正文


Python utils.concat方法代码示例

本文整理汇总了Python中jinja2.utils.concat方法的典型用法代码示例。如果您正苦于以下问题:Python utils.concat方法的具体用法?Python utils.concat怎么用?Python utils.concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jinja2.utils的用法示例。


在下文中一共展示了utils.concat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: return_buffer_contents

# 需要导入模块: from jinja2 import utils [as 别名]
# 或者: from jinja2.utils import concat [as 别名]
def return_buffer_contents(self, frame, force_unescaped=False):
        """Return the buffer contents of the frame."""
        if not force_unescaped:
            if frame.eval_ctx.volatile:
                self.writeline('if context.eval_ctx.autoescape:')
                self.indent()
                self.writeline('return Markup(concat(%s))' % frame.buffer)
                self.outdent()
                self.writeline('else:')
                self.indent()
                self.writeline('return concat(%s)' % frame.buffer)
                self.outdent()
                return
            elif frame.eval_ctx.autoescape:
                self.writeline('return Markup(concat(%s))' % frame.buffer)
                return
        self.writeline('return concat(%s)' % frame.buffer) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:19,代码来源:compiler.py

示例2: visit_AssignBlock

# 需要导入模块: from jinja2 import utils [as 别名]
# 或者: from jinja2.utils import concat [as 别名]
def visit_AssignBlock(self, node, frame):
        self.push_assign_tracking()
        block_frame = frame.inner()
        # This is a special case.  Since a set block always captures we
        # will disable output checks.  This way one can use set blocks
        # toplevel even in extended templates.
        block_frame.require_output_check = False
        block_frame.symbols.analyze_node(node)
        self.enter_frame(block_frame)
        self.buffer(block_frame)
        self.blockvisit(node.body, block_frame)
        self.newline(node)
        self.visit(node.target, frame)
        self.write(' = (Markup if context.eval_ctx.autoescape '
                   'else identity)(')
        if node.filter is not None:
            self.visit_Filter(node.filter, block_frame)
        else:
            self.write('concat(%s)' % block_frame.buffer)
        self.write(')')
        self.pop_assign_tracking(frame)
        self.leave_frame(block_frame)

    # -- Expression Visitors 
开发者ID:remg427,项目名称:misp42splunk,代码行数:26,代码来源:compiler.py

示例3: visit_AssignBlock

# 需要导入模块: from jinja2 import utils [as 别名]
# 或者: from jinja2.utils import concat [as 别名]
def visit_AssignBlock(self, node, frame):
        block_frame = frame.inner()
        block_frame.inspect(node.body)
        aliases = self.push_scope(block_frame)
        self.pull_locals(block_frame)
        self.buffer(block_frame)
        self.blockvisit(node.body, block_frame)
        self.pop_scope(aliases, block_frame)

        assignment_frame = self.make_assignment_frame(frame)
        self.newline(node)
        self.visit(node.target, assignment_frame)
        self.write(' = concat(%s)' % block_frame.buffer)
        self.export_assigned_vars(frame, assignment_frame)

    # -- Expression Visitors 
开发者ID:jpush,项目名称:jbox,代码行数:18,代码来源:compiler.py

示例4: visit_AssignBlock

# 需要导入模块: from jinja2 import utils [as 别名]
# 或者: from jinja2.utils import concat [as 别名]
def visit_AssignBlock(self, node, frame):
        self.push_assign_tracking()
        block_frame = frame.inner()
        # This is a special case.  Since a set block always captures we
        # will disable output checks.  This way one can use set blocks
        # toplevel even in extended templates.
        block_frame.require_output_check = False
        block_frame.symbols.analyze_node(node)
        self.enter_frame(block_frame)
        self.buffer(block_frame)
        self.blockvisit(node.body, block_frame)
        self.newline(node)
        self.visit(node.target, frame)
        self.write(' = (Markup if context.eval_ctx.autoescape '
                   'else identity)(concat(%s))' % block_frame.buffer)
        self.pop_assign_tracking(frame)
        self.leave_frame(block_frame)

    # -- Expression Visitors 
开发者ID:liantian-cn,项目名称:RSSNewsGAE,代码行数:21,代码来源:compiler.py


注:本文中的jinja2.utils.concat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。