笨鸟编程-零基础入门Pyhton教程

 找回密码
 立即注册

扩展

发布者: 笨鸟自学网



classjinja2.nodes.Block(namebodyscoped)

A node that represents a block.

Node type:Stmt
classjinja2.nodes.Break

Break a loop.

Node type:Stmt
classjinja2.nodes.CallBlock(callargsdefaultsbody)

Like a macro without a name but a call instead. call is called with the unnamed macro as caller argument this node holds.

Node type:Stmt
classjinja2.nodes.Continue

Continue a loop.

Node type:Stmt
classjinja2.nodes.EvalContextModifier(options)

Modifies the eval context. For each option that should be modified, a Keyword has to be added to the options list.

Example to change the autoescape setting:

EvalContextModifier(options=[Keyword('autoescape', Const(True))])
Node type:Stmt
classjinja2.nodes.ScopedEvalContextModifier(optionsbody)

Modifies the eval context and reverts it later. Works exactly like EvalContextModifier but will only modify the EvalContext for nodes in the body.

Node type:EvalContextModifier
classjinja2.nodes.ExprStmt(node)

A statement that evaluates an expression and discards the result.

Node type:Stmt
classjinja2.nodes.Extends(template)

Represents an extends statement.

Node type:Stmt
classjinja2.nodes.FilterBlock(bodyfilter)

Node for filter sections.

Node type:Stmt
classjinja2.nodes.For(targetiterbodyelse_testrecursive)

The for loop. target is the target for the iteration (usually a Name or Tuple), iter the iterable. body is a list of nodes that are used as loop-body, and else_ a list of nodes for the else block. If no else node exists it has to be an empty list.

For filtered nodes an expression can be stored as test, otherwise None.

Node type:Stmt
classjinja2.nodes.FromImport(templatenameswith_context)

A node that represents the from import tag. It’s important to not pass unsafe names to the name attribute. The compiler translates the attribute lookups directly into getattr calls and does not use the subscript callback of the interface. As exported variables may not start with double underscores (which the parser asserts) this is not a problem for regular Jinja code, but if this node is used in an extension extra care must be taken.

The list of names may contain tuples if aliases are wanted.

Node type:Stmt
classjinja2.nodes.If(testbodyelse_)

If test is true, body is rendered, else else_.

Node type:Stmt
classjinja2.nodes.Import(templatetargetwith_context)

A node that represents the import tag.

Node type:Stmt
classjinja2.nodes.Include(templatewith_contextignore_missing)

A node that represents the include tag.

Node type:Stmt
classjinja2.nodes.Macro(nameargsdefaultsbody)

A macro definition. name is the name of the macro, args a list of arguments and defaults a list of defaults if there are any. 

上一篇:模板设计者文档下一篇:集成

Archiver|手机版|笨鸟自学网 ( 粤ICP备20019910号 )

GMT+8, 2024-10-18 19:26 , Processed in 0.019905 second(s), 17 queries .

© 2001-2020