[MediaWiki-commits] [Gerrit] pywikibot/core[master]: upload.py: remove "Do you want to change this description?" ...

2017-05-03 Thread jenkins-bot (Code Review)
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 
Gerrit-Reviewer: Framawiki 
Gerrit-Reviewer: Gerrit Patch Uploader 
Gerrit-Reviewer: John Vandenberg 
Gerrit-Reviewer: Magul 
Gerrit-Reviewer: Matěj Suchánek 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] pywikibot/core[master]: upload.py: remove "Do you want to change this description?" ...

2017-04-17 Thread Gerrit Patch Uploader (Code Review)
Gerrit Patch Uploader has uploaded a new change for review. ( 
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

Bug: T163108
Change-Id: Iec43845e293721aee70d8f1129b323d7fbceb8b8
---
M pywikibot/specialbots.py
1 file changed, 10 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/85/348485/1

diff --git a/pywikibot/specialbots.py b/pywikibot/specialbots.py
index 72e079c..2e43e0f 100644
--- a/pywikibot/specialbots.py
+++ b/pywikibot/specialbots.py
@@ -332,22 +332,25 @@
 
 # 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:
+if self.description:
+pywikibot.output(u'The suggested description is:\n%s'
+ % self.description)
+else:
+pywikibot.output(u'No description was given.')
 self.verifyDescription = True
 
 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}'))
-
+'It is not possible to upload a file without a 
description. '
+'Please enter a description in the window.'))
 assert not always
 # if no description, default is 'yes'
-if pywikibot.input_yn(
+if not self.description or pywikibot.input_yn(
 u'Do you want to change this description?',
 default=not self.description):
 from pywikibot import editor as editarticle

-- 
To view, visit https://gerrit.wikimedia.org/r/348485
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec43845e293721aee70d8f1129b323d7fbceb8b8
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader 
Gerrit-Reviewer: Framawiki 
Gerrit-Reviewer: Gerrit Patch Uploader 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits