jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/388254 )
Change subject: Prettiest error when username is not precice in user-config
......................................................................
Prettiest error when username is not precice in user-config
Bug: T159972
Change-Id: I6cf5b1b6b81b83773e9b4b99a8a37b38bebb733f
---
M pywikibot/site.py
1 file changed, 15 insertions(+), 5 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 7b09c7f..ac96812 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2079,11 +2079,21 @@
if sysop:
raise NoUsername('No sysop is permitted with OAuth')
elif self.userinfo['name'] != self._username[sysop]:
- raise NoUsername('Logged in on %(site)s via OAuth as '
- '%(wrong)s, but expect as %(right)s'
- % {'site': self,
- 'wrong': self.userinfo['name'],
- 'right': self._username[sysop]})
+ if self._username == [None, None]:
+ raise NoUsername('No username has been defined in your '
+ 'user-config.py: you have to add in this '
+ 'file the following line:\n'
+ "usernames['{family}']['{lang}'] "
+ "= '{username}'"
+ .format(family=self.family,
+ lang=self.lang,
+ username=self.userinfo['name']))
+ else:
+ raise NoUsername('Logged in on {site} via OAuth as '
+ '{wrong}, but expect as {right}'
+ .format(site=self,
+ wrong=self.userinfo['name'],
+ right=self._username[sysop]))
else:
raise NoUsername('Logging in on %s via OAuth failed' % self)
loginMan = api.LoginManager(site=self, sysop=sysop,
--
To view, visit https://gerrit.wikimedia.org/r/388254
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6cf5b1b6b81b83773e9b4b99a8a37b38bebb733f
Gerrit-PatchSet: 6
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/401373 )
Change subject: [DOC] Update pwb LICENSE
......................................................................
[DOC] Update pwb LICENSE
Change-Id: I13d676ff57fb70ea2d60748598cce6b40d0fe823
---
M LICENSE
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
Zoranzoki21: Looks good to me, but someone else must approve
diff --git a/LICENSE b/LICENSE
index 54b9519..90dbacc 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2017 Pywikibot team
+Copyright (c) 2004-2018 Pywikibot team
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
--
To view, visit https://gerrit.wikimedia.org/r/401373
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I13d676ff57fb70ea2d60748598cce6b40d0fe823
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: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/400977 )
Change subject: protect.py: Add expiry parameter
......................................................................
protect.py: Add expiry parameter
If the paramater is unset, use None, meaning indefinite and protection
will not expire automatically. If '-expiry' is set but the value is
unspecified, the script will prompt with pywikibot.input(). The value,
either specified directly or in by the prompt, will be passes to
page.protect(), which will then pass it on to site.protect().
Bug: T183796
Change-Id: I486b5b140c46460048d55d14e1be3309dc7e1744
---
M scripts/protect.py
1 file changed, 13 insertions(+), 0 deletions(-)
Approvals:
Framawiki: Looks good to me, but someone else must approve
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/protect.py b/scripts/protect.py
index 92d5934..47f7551 100755
--- a/scripts/protect.py
+++ b/scripts/protect.py
@@ -16,6 +16,11 @@
the page selector. If no summary is supplied or couldn't
determine one from the selector it'll ask for one.
+-expiry: Supply a custom protection expiry, which defaults to
+ indefinite. Any string understandable by MediaWiki, including
+ relative and absolute, is acceptable. See:
+ https://www.mediawiki.org/wiki/API:Protect#Parameters
+
-unprotect Acts like "default:all"
-default: Sets the default protection level (default 'sysop'). If no
@@ -84,6 +89,7 @@
"""
self.availableOptions.update({
'summary': None,
+ 'expiry': None,
})
super(ProtectionRobot, self).__init__(site=site, **kwargs)
self.generator = generator
@@ -104,6 +110,7 @@
protections = dict(
prot for prot in self.protections.items() if prot[0] in applicable)
page.protect(reason=self.getOption('summary'),
+ expiry=self.getOption('expiry'),
protections=protections)
@@ -177,6 +184,12 @@
options['summary'] = None
else:
options['summary'] = arg[len('-summary:'):]
+ elif arg.startswith('-expiry'):
+ if len(arg) == len('-expiry'):
+ options['expiry'] = pywikibot.input(
+ 'Enter a protection expiry:')
+ else:
+ options['expiry'] = arg[len('-expiry:'):]
elif arg.startswith('-images'):
pywikibot.output(color_format(
'\n{lightred}-image option is deprecated. '
--
To view, visit https://gerrit.wikimedia.org/r/400977
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I486b5b140c46460048d55d14e1be3309dc7e1744
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
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: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>