浏览代码

nodes: Add __contains__ to Template

This allows the use of `key in Template` syntax
pull/252/head
AntiCompositeNumber 3 年前
父节点
当前提交
b87f4eef8f
找不到此签名对应的密钥 GPG 密钥 ID: A888A323AB506229
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. +3
    -0
      mwparserfromhell/nodes/template.py

+ 3
- 0
mwparserfromhell/nodes/template.py 查看文件

@@ -214,6 +214,9 @@ class Template(Node):
"""Alias for :meth:`has`."""
return self.has(name, ignore_empty)

def __contains__(self, name):
return self.has(name)

def get(self, name, default=_UNSET):
"""Get the parameter whose name is *name*.



正在加载...
取消
保存