jenkins-bot has submitted this change and it was merged.
Change subject: upload.py: early detection of site capabilities ......................................................................
upload.py: early detection of site capabilities
If site is not enabled to upload or user han no right, the script quits immediately.
Bug 69090
Change-Id: I305b4fb18cf87797c551d7978e0f69ffe61cb5db --- M scripts/upload.py 1 file changed, 15 insertions(+), 0 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/upload.py b/scripts/upload.py index 65fc037..1418fa2 100755 --- a/scripts/upload.py +++ b/scripts/upload.py @@ -294,6 +294,21 @@ return filename # data['filename']
def run(self): + + # early check that upload is enabled + if self.targetSite.is_uploaddisabled(): + pywikibot.error( + "Upload error: Local file uploads are disabled on %s." + % self.targetSite) + return + + # early check that user has proper rights to upload + if "upload" not in self.targetSite.userinfo["rights"]: + pywikibot.error( + "User '%s' does not have upload rights on site %s." + % (self.targetSite.user(), self.targetSite)) + return + while not self.urlOK(): if not self.url: pywikibot.output(u'No input filename given')
pywikibot-commits@lists.wikimedia.org