當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。