浏览代码

Fix a bug when handling the archiving of old cases.

pull/8/merge
Ben Kurtovic 11 年前
父节点
当前提交
d764983a2c
共有 1 个文件被更改,包括 10 次插入6 次删除
  1. +10
    -6
      tasks/drn_clerkbot.py

+ 10
- 6
tasks/drn_clerkbot.py 查看文件

@@ -427,12 +427,16 @@ class DRNClerkBot(Task):
if closed_age > 60 * 60 * 24 and modify_age > 60 * 60 * 24:
arch_top = self.tl_archive_top
arch_bottom = self.tl_archive_bottom
reg = "<!-- \[\[User:DoNotArchiveUntil\]\] .*? -->(<!-- .*? -->)?"
if re.search(reg, case.body):
case.body = re.sub("\{\{" + arch_top + "\}\}", "", case.body)
case.body = re.sub(reg, "{{" + arch_top + "}}", case.body)
if not re.search(arch_bottom + "\s*\}\}\s*\Z", case.body):
case.body += "\n{{" + arch_bottom + "}}"
reg = r"<!-- \[\[User:DoNotArchiveUntil\]\] .*? -->(<!-- .*? -->)?"
if re.search(r"\{\{\s*" + arch_top, case.body):
if re.search(reg, case.body):
case.body = re.sub(reg, "", case.body)
else:
if re.search(reg, case.body):
case.body = re.sub(r"\{\{" + arch_top + r"\}\}", "", case.body)
case.body = re.sub(reg, "{{" + arch_top + "}}", case.body)
if not re.search(arch_bottom + r"\s*\}\}\s*\Z", case.body):
case.body += "\n{{" + arch_bottom + "}}"
case.archived = True
self.logger.debug(u" {0}: archived case".format(case.id))



正在加载...
取消
保存