我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用jinja2.nodes.ExtensionAttribute()。
def attr(self, name, lineno=None): """Return an attribute node for the current extension. This is useful to pass constants on extensions to generated template code. :: self.attr('_my_attribute', lineno=lineno) """ return nodes.ExtensionAttribute(self.identifier, name, lineno=lineno)
def attr(self, name, lineno=None): """Return an attribute node for the current extension. This is useful to pass constants on extensions to generated template code:: self.attr('_my_attribute', lineno=lineno) """ return nodes.ExtensionAttribute(self.identifier, name, lineno=lineno)
def walk_nodes(self, node, block_name=None, context=None): for node in self.get_nodelist(node): if (isinstance(node, CallBlock) and isinstance(node.call, Call) and isinstance(node.call.node, ExtensionAttribute) and node.call.node.identifier == self.COMPRESSOR_ID): node.call.node.name = '_compress_forced' yield node else: for node in self.walk_nodes(node, block_name=block_name): yield node