Sfoglia il codice sorgente

nodes: Add __contains__ to Template

This allows the use of `key in Template` syntax
pull/252/head
AntiCompositeNumber 3 anni fa
parent
commit
b87f4eef8f
Non sono state trovate chiavi note per questa firma nel database ID Chiave GPG: A888A323AB506229
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. +3
    -0
      mwparserfromhell/nodes/template.py

+ 3
- 0
mwparserfromhell/nodes/template.py Vedi File

@@ -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*.



Caricamento…
Annulla
Salva