jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/331862 )
Change subject: [IMPR] Add [q] option for edit choice
......................................................................
[IMPR] Add [q] option for edit choice
Bug: T155045
Change-Id: If3f4b3f7fc33f1bc62b488dd49d734f1bb8fa5d9
---
M scripts/add_text.py
1 file changed, 10 insertions(+), 5 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/add_text.py b/scripts/add_text.py
index 90bd4a6..2ed3a33 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -56,7 +56,7 @@
#
# (C) Filnik, 2007-2010
-# (C) Pywikibot team, 2007-2016
+# (C) Pywikibot team, 2007-2017
#
# Distributed under the terms of the MIT license.
#
@@ -67,11 +67,13 @@
import codecs
import re
+import sys
import time
import pywikibot
from pywikibot import config, i18n, pagegenerators, textlib
+from pywikibot.bot_choice import QuitKeyboardInterrupt
from pywikibot.tools.formatter import color_format
docuReplacements = {
@@ -169,10 +171,13 @@
# text in the page
if putText:
if not always:
- choice = pywikibot.input_choice(
- u'Do you want to accept these changes?',
- [('Yes', 'y'), ('No', 'n'),
('All', 'a'),
- ('open in Browser', 'b')], 'n',
automatic_quit=False)
+ try:
+ choice = pywikibot.input_choice(
+ 'Do you want to accept these changes?',
+ [('Yes', 'y'), ('No', 'n'),
('All', 'a'),
+ ('open in Browser', 'b')], 'n')
+ except QuitKeyboardInterrupt:
+ sys.exit('User quit bot run.')
if choice == 'a':
always = True
elif choice == 'n':
--
To view, visit
https://gerrit.wikimedia.org/r/331862
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If3f4b3f7fc33f1bc62b488dd49d734f1bb8fa5d9
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>