jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Upload: Allow to accept the current description
......................................................................
[FIX] Upload: Allow to accept the current description
Previously it wasn't possible to simply accept the description,
because the while condition never changed.
Change-Id: I3253fe4a86843b17210451f650821f3ef014d2e4
---
M scripts/upload.py
1 file changed, 17 insertions(+), 14 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/upload.py b/scripts/upload.py
index 5ab1607..9261661 100755
--- a/scripts/upload.py
+++ b/scripts/upload.py
@@ -193,29 +193,32 @@
pywikibot.output(u'The suggested description is:\n%s'
% self.description)
+ # Description must be set and verified
+ if not self.description:
+ self.verifyDescription = True
+
while not self.description or self.verifyDescription:
if not self.description:
pywikibot.output(
u'\03{lightred}It is not possible to upload a file '
'without a summary/description.\03{default}')
- if not self.description or self.verifyDescription:
- newDescription = u''
- # if no description, default is 'yes'
- default = 'y' if not self.description else 'n'
- choice = pywikibot.inputChoice(
- u'Do you want to change this description?',
- ['Yes', 'No', 'Quit'], ['y',
'n', 'q'], default)
- if choice == 'y':
- from pywikibot import editor as editarticle
- editor = editarticle.TextEditor()
- newDescription = editor.edit(self.description)
- elif choice == 'q':
- raise QuitKeyboardInterrupt
+ # if no description, default is 'yes'
+ default = 'y' if not self.description else 'n'
+ choice = pywikibot.inputChoice(
+ u'Do you want to change this description?',
+ ['Yes', 'No', 'Quit'], ['y', 'n',
'q'], default)
+ if choice == 'y':
+ from pywikibot import editor as editarticle
+ editor = editarticle.TextEditor()
+ newDescription = editor.edit(self.description)
# if user saved / didn't press Cancel
if newDescription:
self.description = newDescription
- break
+ if choice == 'q':
+ raise QuitKeyboardInterrupt
+ else:
+ self.verifyDescription = False
return filename
--
To view, visit
https://gerrit.wikimedia.org/r/158529
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3253fe4a86843b17210451f650821f3ef014d2e4
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>