Browse Source

Fix a bug when handling the archiving of old cases.

pull/8/merge
Ben Kurtovic 12 years ago
parent
commit
d764983a2c
1 changed files with 10 additions and 6 deletions
  1. +10
    -6
      tasks/drn_clerkbot.py

+ 10
- 6
tasks/drn_clerkbot.py View File

@@ -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))



Loading…
Cancel
Save