jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/674578 )
Change subject: [cleanup] use revisions instead of deprecated getLatestEditors ......................................................................
[cleanup] use revisions instead of deprecated getLatestEditors
- replace getLatestEditors with list(revisions) - use len(history) instead comparing timestamps - second_text is set previously; no need to set it to False - remove return statement at the end of the block
Change-Id: I136b68986fb4a24f1a131283b56d671d3b594747 --- M scripts/checkimages.py 1 file changed, 6 insertions(+), 11 deletions(-)
Approvals: Huji: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py index cde33f7..cc6a476 100755 --- a/scripts/checkimages.py +++ b/scripts/checkimages.py @@ -652,26 +652,24 @@ emailPageName = i18n.translate(self.site, emailPageWithText) emailSubj = i18n.translate(self.site, emailSubject) if self.notification2: - self.notification2 = self.notification2 % self.image_to_report + self.notification2 %= self.image_to_report else: self.notification2 = self.notification - second_text = False
+ second_text = False # Getting the talk page's history, to check if there is another # advise... try: testoattuale = self.talk_page.get() - history = self.talk_page.getLatestEditors(limit=10) + history = list(self.talk_page.revisions(total=10)) latest_user = history[0]['user'] pywikibot.output( 'The latest user that has written something is: ' + latest_user) - if latest_user in self.bots: + # A block to prevent the second message if the bot also + # welcomed users... + if latest_user in self.bots and len(history) > 1: second_text = True - # A block to prevent the second message if the bot also - # welcomed users... - if history[0]['timestamp'] == history[-1]['timestamp']: - second_text = False except pywikibot.IsRedirectPage: pywikibot.output( 'The user talk is a redirect, trying to get the right talk...') @@ -679,11 +677,9 @@ self.talk_page = self.talk_page.getRedirectTarget() testoattuale = self.talk_page.get() except pywikibot.NoPage: - second_text = False testoattuale = i18n.translate(self.site, empty) except pywikibot.NoPage: pywikibot.output('The user page is blank') - second_text = False testoattuale = i18n.translate(self.site, empty)
if self.commTalk: @@ -725,7 +721,6 @@ emailClass.send_email(emailSubj, text_to_send) except NotEmailableError: pywikibot.output('User is not mailable, aborted') - return
def regexGenerator(self, regexp, textrun) -> Generator[pywikibot.FilePage, None, None]:
pywikibot-commits@lists.wikimedia.org