<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                *class?*jinja2.runtime.Context[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.runtime.Context "Permalink to this definition") The template context holds the variables of a template. It stores the values passed to the template and also the names the template exports. Creating instances is neither supported nor useful as it’s created automatically at various stages of the template evaluation and should not be created by hand. The context is immutable. Modifications on?[parent](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Context.parent "jinja2.Context.parent")?**must not**?happen and modifications on?[vars](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Context.vars "jinja2.Context.vars")?are allowed from generated template code only. Template filters and global functions marked as?[contextfunction()](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.contextfunction "jinja2.contextfunction")s get the active context passed as first argument and are allowed to access the context read-only. The template context supports read only dict operations (get,?keys,?values,?items,iterkeys,?itervalues,?iteritems,?__getitem__,?__contains__). Additionally there is aresolve()?method that doesn’t fail with a?KeyError?but returns an?[Undefined](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Undefined "jinja2.Undefined")?object for missing variables. parent[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Context.parent "Permalink to this definition") 一個模板查找的只讀全局變量的詞典。這些變量可能來自另一個?Context?,或是[Environment.globals](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Environment.globals "jinja2.Environment.globals")?,或是?[Template.globals](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Template.globals "jinja2.Template.globals")?,或指向一個由全局變量和傳遞到渲染函數的變 量聯立的字典。它一定不能被修改。 vars[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Context.vars "Permalink to this definition") 模板局域變量。這個列表包含環境和來自?[parent](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Context.parent "jinja2.Context.parent")?范圍的上下文函數 以及局域修改和從模板中導出的變量。模板會在模板求值時修改這個字典, 但過濾器和上下文函數不允許修改它。 environment[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Context.environment "Permalink to this definition") 加載該模板的環境 exported_vars[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Context.exported_vars "Permalink to this definition") 這設定了所有模板導出量的名稱。名稱對應的值在?[vars](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Context.vars "jinja2.Context.vars")?字典中。 可以用get_exported()?獲取一份導出變量的拷貝字典。 name[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Context.name "Permalink to this definition") 擁有此上下文的模板的載入名。 blocks[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Context.blocks "Permalink to this definition") 模板中塊當前映射的字典。字典中的鍵是塊名稱,值是注冊的塊的列表。每個 列表的最后一項是當前活動的塊(繼承鏈中最新的)。 eval_ctx[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Context.eval_ctx "Permalink to this definition") 當前的?[*求值上下文*](http://docs.jinkan.org/docs/jinja2/api.html#eval-context)?。 call(*callable*,?**args*,?***kwargs*)[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.runtime.Context.call "Permalink to this definition") Call the callable with the arguments and keyword arguments provided but inject the active context or environment as first argument if the callable is a[contextfunction()](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.contextfunction "jinja2.contextfunction")?or?[environmentfunction()](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.environmentfunction "jinja2.environmentfunction"). get_all()[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.runtime.Context.get_all "Permalink to this definition") Return a copy of the complete context as dict including the exported variables. get_exported()[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.runtime.Context.get_exported "Permalink to this definition") Get a new dict with the exported variables. resolve(*key*)[](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.runtime.Context.resolve "Permalink to this definition") Looks up a variable like?__getitem__?or?get?but returns an?[Undefined](http://docs.jinkan.org/docs/jinja2/api.html#jinja2.Undefined "jinja2.Undefined")?object with the name of the name looked up. 實現 Python frame 中的局域變量在函數中是不可變的,出于同樣的原因,上下文是不可 變的。 Jinja2 和 Python 都不把上下文/ frame 作為變量的數據存儲,而只作為 主要的數據源。 當模板訪問一個模板中沒有定義的變量時, Jinja2 在上下文中查找變量,此后, 這個變量被視為其是在模板中定義得一樣。
                  <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>

                              哎呀哎呀视频在线观看