<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                求值上下文(縮寫為 eval context 或 eval ctx )是 Jinja 2.4 中引入的新對象, 并可以在運行時激活/停用已編譯的特性。 當前它只用于啟用和禁用自動轉義,但也可以用于擴展。 在之前的 Jinja 版本中,過濾器和函數被標記為環境可調用的來從環境中檢查自動 轉義的狀態。在新版本中鼓勵通過求值上下文來檢查這個設定。 之前的版本: ~~~ @environmentfilter def filter(env, value): result = do_something(value) if env.autoescape: result = Markup(result) return result ~~~ 在新版本中,你可以用?[contextfilter()](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.contextfilter "jinja2.contextfilter")?從實際的上下文中訪問求值上下 文,或用[evalcontextfilter()](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.evalcontextfilter "jinja2.evalcontextfilter")?直接把求值上下文傳遞給函數: ~~~ @contextfilter def filter(context, value): result = do_something(value) if context.eval_ctx.autoescape: result = Markup(result) return result @evalcontextfilter def filter(eval_ctx, value): result = do_something(value) if eval_ctx.autoescape: result = Markup(result) return result ~~~ 求值上下文一定不能在運行時修改。修改只能在擴展中的 用?[nodes.EvalContextModifier](http://docs.jinkan.org/docs/jinja2/extensions.html#jinja2.nodes.EvalContextModifier "jinja2.nodes.EvalContextModifier")?和[nodes.ScopedEvalContextModifier](http://docs.jinkan.org/docs/jinja2/extensions.html#jinja2.nodes.ScopedEvalContextModifier "jinja2.nodes.ScopedEvalContextModifier")?發生,而不是通過求值上下文對 象本身。 *class?*jinja2.nodes.EvalContext(*environment*,?*template_name=None*)[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.nodes.EvalContext "Permalink to this definition") Holds evaluation time information. Custom attributes can be attached to it in extensions. autoescape[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.EvalContext.autoescape "Permalink to this definition") True?或?False?取決于自動轉義是否激活。 volatile[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.EvalContext.volatile "Permalink to this definition") 如果編譯器不能在編譯期求出某些表達式的值,為?True?。在運行時應該 始終為False?。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看