jenkins-bot has submitted this change and it was merged.
Change subject: archivebot: search for the marker template and fail earlier before making changes ......................................................................
archivebot: search for the marker template and fail earlier before making changes
Change-Id: I55ac08d0e726ed6f579c6b1325f9bbc3ed2c6423 --- M scripts/archivebot.py 1 file changed, 7 insertions(+), 5 deletions(-)
Approvals: XZise: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/archivebot.py b/scripts/archivebot.py index c76ddde..2506408 100644 --- a/scripts/archivebot.py +++ b/scripts/archivebot.py @@ -548,6 +548,13 @@ % (self.archived_threads, mintoarchive)) return if whys: + # Search for the marker template + rx = re.compile(r'{{%s\s*?\n.*?\n}}' + % (template_title_regex(self.tpl).pattern), re.DOTALL) + if not rx.search(self.page.header): + pywikibot.error("Couldn't find the template in the header") + return + pywikibot.output(u'Archiving %d thread(s).' % self.archived_threads) # Save the archives first (so that bugs don't cause a loss of data) for a in sorted(self.archives.keys()): @@ -558,11 +565,6 @@ self.archives[a].update(comment)
# Save the page itself - rx = re.compile(r'{{%s\s*?\n.*?\n}}' - % (template_title_regex(self.tpl).pattern), re.DOTALL) - if not rx.search(self.page.header): - pywikibot.error("Couldn't find the template in the header") - return self.page.header = rx.sub(self.attr2text(), self.page.header) self.comment_params['count'] = self.archived_threads comma = self.site.mediawiki_message('comma-separator')
pywikibot-commits@lists.wikimedia.org