瀏覽代碼

ignore_empty for Template.has_param()

tags/v0.1
Ben Kurtovic 12 年之前
父節點
當前提交
7fe4509e36
共有 1 個檔案被更改,包括 3 行新增1 行删除
  1. +3
    -1
      mwparserfromhell/nodes/template.py

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

@@ -58,10 +58,12 @@ class Template(Node):
def params(self):
return self._params

def has_param(self, name):
def has_param(self, name, ignore_empty=True):
name = name.strip() if isinstance(name, basestring) else unicode(name)
for param in self.params:
if param.name.strip() == name:
if ignore_empty and not param.value.strip():
continue
return True
return False



Loading…
取消
儲存