jenkins-bot has submitted this change and it was merged.
Change subject: use ValueError when hardcoded config is insecure
......................................................................
use ValueError when hardcoded config is insecure
The library exception UserActionRefuse is used by the library for
action against a target user that are not possible, such as when
attempting to send an email to a user that has email disabled.
The script_wui constructor is using UserActionRefuse when its hardcoded
config values include a page title which does not end in .js or .css,
which is one way to have a semi-protected wiki page. The compat version
subster.py does not use this exception.
As this exception is raised only when there is a problem with the
hard-coded config value defined in the same module, and backwards
compatibility would require complicating the library exceptions for the
benefit of only one script which is not in widespread use, and any
working script which monkey-patches script_wui.bot_config needs must
already have a valid config in order to bypass this exception and it
extremely unlikely that any working script will be handling this
exception appropriately, the exception raised is simply changed to
ValueError.
Change-Id: Ic3674c3a82484f7d263bae337db9ed6948c8d228
---
M scripts/script_wui.py
1 file changed, 5 insertions(+), 1 deletion(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/script_wui.py b/scripts/script_wui.py
index 65d7148..12dea61 100755
--- a/scripts/script_wui.py
+++ b/scripts/script_wui.py
@@ -147,7 +147,11 @@
for item in self.refs:
# security; first check if page is protected, reject any data if not
if os.path.splitext(self.refs[item].title().lower())[1] not in ['.css', '.js']:
- raise pywikibot.UserActionRefuse(u'Page %s is not secure, e.g. semi-protected!' % self.refs[item])
+ raise ValueError(u'%s config %s = %s is not a secure page; '
+ u'it should be a css or js userpage which are '
+ u'automatically semi-protected.'
+ % (self.__class__.__name__, item,
+ self.refs[item]))
self.refs[item].get(force=True) # load all page contents
# init background timer
--
To view, visit https://gerrit.wikimedia.org/r/180705
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic3674c3a82484f7d263bae337db9ed6948c8d228
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #1836
Status: Fixed
Duration: 21 minutes and 26 seconds
Commit: 8cc0f76 (master)
Author: gladoscc
Message: [FIX] TokenWallet: Assert a username
Follow up to Iccce554b5c9e83a42ae87c0bd69e38f880e3f6ac
Fixes another place where assert would fail if the
sysop username is different to the normal username.
Bug: T74238
Change-Id: I7c438e16d40ff7128980fd2eecf1575eeac40114
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/bf42d7a01548...8cc0f76b…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/44712102
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] TokenWallet: Assert a username
......................................................................
[FIX] TokenWallet: Assert a username
Follow up to Iccce554b5c9e83a42ae87c0bd69e38f880e3f6ac
Fixes another place where assert would fail if the
sysop username is different to the normal username.
Bug: T74238
Change-Id: I7c438e16d40ff7128980fd2eecf1575eeac40114
---
M pywikibot/site.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 48aafc8..6fa32a7 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -1331,7 +1331,7 @@
in one request.
@type all: bool
"""
- assert(self.site.logged_in())
+ assert(self.site.user())
self._tokens.setdefault(self.site.user(), {}).update(
self.site.get_tokens(types, all=all))
--
To view, visit https://gerrit.wikimedia.org/r/181353
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7c438e16d40ff7128980fd2eecf1575eeac40114
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Unicodesnowman <admin(a)glados.cc>
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 <>
jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] new regex for retrieving page titles from special page.
......................................................................
[bugfix] new regex for retrieving page titles from special page.
The title part or list elements may contain html entities which
will be interpreted as section while instanciating the page and
leads to an invalid title exception (e.g. invalid section in
category).
Now the page title will be fetched from that part inside the <a />
tag.
Change-Id: I15383809fbb911e4d8722dfb87c04b71d182bf7f
---
M redirect.py
1 file changed, 8 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/redirect.py b/redirect.py
index 1cd7c40..cb26269 100644
--- a/redirect.py
+++ b/redirect.py
@@ -69,6 +69,8 @@
import query
import xmlreader
+SPECIALPAGE_REGEX = '\<li\>\<a href=".+?" title=".*?">(.+?)</a>'
+
class RedirectGenerator:
def __init__(self, xmlFilename=None, namespaces=[], offset=-1,
@@ -127,7 +129,7 @@
if target.startswith('%s:' % code) \
or target.startswith(':%s:' % code):
if code == self.site.language():
- # link to our wiki, but with the lang prefix
+ # link to our wiki, but with the lang prefix
target = target[(len(code) + 1):]
if target.startswith(':'):
target = target[1:]
@@ -234,7 +236,7 @@
params = {
'action': 'query',
'redirects': 1,
- #'': '',
+ # '': '',
}
for apiQ in self._next_redirect_group():
params['pageids'] = apiQ
@@ -294,7 +296,7 @@
# regular expression which finds redirects which point to a
# non-existing page inside the HTML
- Rredir = re.compile('\<li\>\<a href=".+?" title="(.*?)"')
+ Rredir = re.compile(SPECIALPAGE_REGEX)
redir_names = Rredir.findall(maintenance_txt)
pywikibot.output(u'Retrieved %d redirects from special page.\n'
@@ -350,7 +352,7 @@
# regular expression which finds redirects which point to
# another redirect inside the HTML
- Rredir = re.compile('\<li\>\<a href=".+?" title="(.*?)">')
+ Rredir = re.compile(SPECIALPAGE_REGEX)
redir_names = Rredir.findall(maintenance_txt)
pywikibot.output(u'Retrieved %i redirects from special page.\n'
% len(redir_names))
@@ -521,8 +523,8 @@
u"Won't delete anything."
% targetPage.title(asLink=True))
else:
- #we successfully get the target page, meaning that
- #it exists and is not a redirect: no reason to touch it.
+ # we successfully get the target page, meaning that
+ # it exists and is not a redirect: no reason to touch it.
pywikibot.output(
u'Redirect target %s does exist! Won\'t delete anything.'
% targetPage.title(asLink=True))
--
To view, visit https://gerrit.wikimedia.org/r/178480
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I15383809fbb911e4d8722dfb87c04b71d182bf7f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Alex S.H. Lin <alexsh(a)mail2000.com.tw>
Gerrit-Reviewer: Andre Engels <andreengels(a)gmail.com>
Gerrit-Reviewer: DrTrigon <dr.trigon(a)surfeu.ch>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>