jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/425981 )
Change subject: [FEAT] Add quit option in patrol.py ......................................................................
[FEAT] Add quit option in patrol.py
Bug: T192084 Change-Id: Ifc6120888dda972130df3e2f3a9fbd93323d3246 --- M scripts/patrol.py 1 file changed, 8 insertions(+), 5 deletions(-)
Approvals: Framawiki: Looks good to me, approved jenkins-bot: Verified
Objections: Zoranzoki21: There's a problem with this change, please improve
diff --git a/scripts/patrol.py b/scripts/patrol.py index 659b76a..743005b 100755 --- a/scripts/patrol.py +++ b/scripts/patrol.py @@ -63,7 +63,7 @@
from pywikibot import pagegenerators
-from pywikibot.bot import SingleSiteBot +from pywikibot.bot import SingleSiteBot, QuitKeyboardInterrupt
_logger = 'patrol'
@@ -303,8 +303,12 @@ self.load_whitelist() if not feed: feed = self.getOption('feed') - for page in feed: - self.treat(page) + try: + for page in feed: + self.treat(page) + except QuitKeyboardInterrupt: + pywikibot.output('\nUser quit {} bot run.' + .format(self.__class__.__name__))
def treat(self, page): """It loads the given page, does some changes, and saves it.""" @@ -349,8 +353,7 @@
if self.getOption('ask'): choice = pywikibot.input_yn( - 'Do you want to mark page as patrolled?', - automatic_quit=False) + 'Do you want to mark page as patrolled?')
# Patrol the page if choice:
pywikibot-commits@lists.wikimedia.org