Sfoglia il codice sorgente

Fix a bug when handling the archiving of old cases.

pull/8/merge
Ben Kurtovic 11 anni fa
parent
commit
d764983a2c
1 ha cambiato i file con 10 aggiunte e 6 eliminazioni
  1. +10
    -6
      tasks/drn_clerkbot.py

+ 10
- 6
tasks/drn_clerkbot.py Vedi 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))



Caricamento…
Annulla
Salva