jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/348485 )
Change subject: upload.py: remove "Do you want to change this description?" when
it's empty
......................................................................
upload.py: remove "Do you want to change this description?" when it's empty
- If no description, ask if user want to add one or quit, and loop until one is filled.
- If self.verifyDescription, ask if user want to change it or continue.
- If neither of them, continues
Bug: T163108
Change-Id: Iec43845e293721aee70d8f1129b323d7fbceb8b8
---
M pywikibot/specialbots.py
1 file changed, 16 insertions(+), 12 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/specialbots.py b/pywikibot/specialbots.py
index 72e079c..f18e381 100644
--- a/pywikibot/specialbots.py
+++ b/pywikibot/specialbots.py
@@ -332,24 +332,26 @@
# A proper description for the submission.
# Empty descriptions are not accepted.
- pywikibot.output(u'The suggested description is:\n%s'
- % self.description)
-
- # Description must be set and verified
- if not self.description:
- self.verifyDescription = True
+ if self.description:
+ pywikibot.output('The suggested description is:\n%s'
+ % self.description)
while not self.description or self.verifyDescription:
if not self.description:
pywikibot.output(color_format(
'{lightred}It is not possible to upload a file '
- 'without a summary/description.{default}'))
-
+ 'without a description.{default}'))
assert not always
- # if no description, default is 'yes'
- if pywikibot.input_yn(
- u'Do you want to change this description?',
- default=not self.description):
+ # if no description, ask if user want to add one or quit,
+ # and loop until one is filled.
+ # if self.verifyDescription, ask if user want to change it
+ # or continue.
+ if self.description:
+ question = 'Do you want to change this description?'
+ else:
+ question = 'No description was given. Add one?'
+ if pywikibot.input_yn(question, default=not self.description,
+ automatic_quit=self.description):
from pywikibot import editor as editarticle
editor = editarticle.TextEditor()
try:
@@ -360,6 +362,8 @@
# if user saved / didn't press Cancel
if newDescription:
self.description = newDescription
+ elif not self.description:
+ raise QuitKeyboardInterrupt
self.verifyDescription = False
return filename
--
To view, visit
https://gerrit.wikimedia.org/r/348485
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iec43845e293721aee70d8f1129b323d7fbceb8b8
Gerrit-PatchSet: 10
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <gerritpatchuploader(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: Gerrit Patch Uploader <gerritpatchuploader(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>