瀏覽代碼

Keep .type and .tag synchronized in Tags when using their setters.

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

+ 7
- 0
mwparserfromhell/nodes/tag.py 查看文件

@@ -252,10 +252,17 @@ class Tag(Node):
if value not in self.TAGS_ALL:
raise ValueError(value)
self._type = value
for key in self.TRANSLATIONS:
if self.TRANSLATIONS[key] == value:
self._tag = parse_anything(key)

@tag.setter
def tag(self, value):
self._tag = parse_anything(value)
try:
self._type = self.TRANSLATIONS[text]
except KeyError:
self._type = self.TAG_UNKNOWN

@contents.setter
def contents(self, value):


Loading…
取消
儲存