jenkins-bot has submitted this change and it was merged.
Change subject: Fix notifications query parse
......................................................................
Fix notifications query parse
In meta=notifications, query.notifications.list was changed to an
actual list, so we should only call values() on it if we're
allowed to. The API change can be viewed at
https://phabricator.wikimedia.org/rECHOb10bd700333d2eef10c7df0a9946b87fd451…
Bug: T138690
Change-Id: I30c9fbd7cc6002106430d1c26a1e3d2d7e8caa65
---
M pywikibot/site.py
1 file changed, 8 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index ce7f628..f8c6996 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2283,8 +2283,14 @@
params['not' + key] = kwargs[key]
data = self._simple_request(**params).submit()
- for notif in data['query']['notifications']['list'].values():
- yield Notification.fromJSON(self, notif)
+ notifications = data['query']['notifications']['list']
+
+ # Support API before 1.27.0-wmf.22
+ if hasattr(notifications, 'values'):
+ notifications = notifications.values()
+
+ for notification in notifications:
+ yield Notification.fromJSON(self, notification)
@need_extension('Echo')
def notifications_mark_read(self, **kwargs):
--
To view, visit https://gerrit.wikimedia.org/r/295567
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I30c9fbd7cc6002106430d1c26a1e3d2d7e8caa65
Gerrit-PatchSet: 12
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: APerson <danielhglus(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Sn1per <geofbot(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: pywikibot: Store ImportError in imported variable
......................................................................
pywikibot: Store ImportError in imported variable
If a lazy ImportError is to be handled, the ImportError
needs to be stored in a variable and then used when required.
Earlier, the imported variable was set to `None` and the
import error which was caught with `except` was used. But
this import error may not exist at a later time as python
guarantees it's existence only inside the `except` statement.
Hence, this is changed so that the ImportError is saved in the
variable that was being imported and checked later using
`isinstance(<variable>, ImportError)`.
(Re-enable F821 disabled in previous commit on 2.0 branch)
Bug: T134336
Change-Id: I80f82e7f0674bfca70688f28640620dacac1d80b
(manually cherry picked from commit 65cabc8258aa807a754a62182ae51fbf7df45ddd)
---
M pywikibot/botirc.py
M pywikibot/diff.py
M scripts/flickrripper.py
M tox.ini
4 files changed, 8 insertions(+), 13 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/botirc.py b/pywikibot/botirc.py
index 77d258a..3294d76 100644
--- a/pywikibot/botirc.py
+++ b/pywikibot/botirc.py
@@ -25,13 +25,15 @@
try:
from ircbot import SingleServerIRCBot
except ImportError as e:
+ ircbot_import_error = e
+
class SingleServerIRCBot(object):
"""Fake SingleServerIRCBot."""
def __init__(*args, **kwargs):
"""Report import exception."""
- raise e
+ raise ircbot_import_error
_logger = "botirc"
diff --git a/pywikibot/diff.py b/pywikibot/diff.py
index 08f939e..ee41492 100644
--- a/pywikibot/diff.py
+++ b/pywikibot/diff.py
@@ -20,11 +20,6 @@
else:
from itertools import izip_longest as zip_longest
-try:
- from bs4 import BeautifulSoup
-except ImportError as bserror:
- BeautifulSoup = False
-
import pywikibot
from pywikibot.tools import chars
@@ -570,9 +565,7 @@
@return: deleted and added list of contexts
@rtype: dict
"""
- # check if BeautifulSoup imported
- if not BeautifulSoup:
- raise bserror # should have been raised and stored earlier.
+ from bs4 import BeautifulSoup
comparands = {'deleted-context': [], 'added-context': []}
soup = BeautifulSoup(compare_string)
diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py
index 38e97df..568b5f2 100755
--- a/scripts/flickrripper.py
+++ b/scripts/flickrripper.py
@@ -62,7 +62,7 @@
try:
from pywikibot.userinterfaces.gui import Tkdialog
except ImportError as _tk_error:
- Tkdialog = None
+ Tkdialog = _tk_error
flickr_allowed_license = {
@@ -295,7 +295,7 @@
override, addCategory,
removeCategories)
# pywikibot.output(photoDescription)
- if Tkdialog is not None and not autonomous:
+ if not isinstance(Tkdialog, ImportError) and not autonomous:
try:
(newPhotoDescription, newFilename, skip) = Tkdialog(
photoDescription, photo, filename).show_dialog()
@@ -305,7 +305,7 @@
autonomous = True
elif not autonomous:
pywikibot.warning('Switching to autonomous mode because GUI interface cannot be used')
- pywikibot.warning(_tk_error)
+ pywikibot.warning(Tkdialog)
autonomous = True
if autonomous:
newPhotoDescription = photoDescription
diff --git a/tox.ini b/tox.ini
index ae7fc47..7fc1161 100644
--- a/tox.ini
+++ b/tox.ini
@@ -23,7 +23,7 @@
flake8-docstrings
[testenv:flake8-py3]
-commands = flake8 --ignore=D102,D103,D105,D211,E122,E127,E241,E402,E731,F821 {posargs}
+commands = flake8 --ignore=D102,D103,D105,D211,E122,E127,E241,E402,E731 {posargs}
basepython = python3
deps = flake8
flake8-docstrings
--
To view, visit https://gerrit.wikimedia.org/r/296411
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I80f82e7f0674bfca70688f28640620dacac1d80b
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: AbdealiJK <abdealikothari(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] pass User page object to NotEmailableError
......................................................................
[bugfix] pass User page object to NotEmailableError
NotEmailableError is derived from PageRelatedError and
expect a page object as first parameter but got a string.
Bug: T135364
Change-Id: I5aad3aaa76802884b744f89a633d716e1aab5286
---
M pywikibot/page.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index a9c7a4e..a78ed9a 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2843,7 +2843,7 @@
@rtype: bool
"""
if not self.isEmailable():
- raise NotEmailableError('%s is not mailable' % self.username)
+ raise NotEmailableError(self)
if not self.site.has_right('sendemail'):
raise UserRightsError('You don\'t have permission to send mail')
--
To view, visit https://gerrit.wikimedia.org/r/290638
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5aad3aaa76802884b744f89a633d716e1aab5286
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Jenkins testing using mwparserfromhell and bs4
......................................................................
Jenkins testing using mwparserfromhell and bs4
Add mwparserfromhell and bs4 to the nose34 rule.
Change-Id: I1d6cabe3f5b58003b3ca922883548742e58d1685
---
M tox.ini
1 file changed, 2 insertions(+), 0 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tox.ini b/tox.ini
index bc027d7..64a7572 100644
--- a/tox.ini
+++ b/tox.ini
@@ -80,6 +80,8 @@
nosetests --version
nosetests --with-detecthttp -v -a '!net' tests
deps =
+ mwparserfromhell
+ beautifulsoup4
nose
nose-detecthttp>=0.1.3
six
--
To view, visit https://gerrit.wikimedia.org/r/296082
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1d6cabe3f5b58003b3ca922883548742e58d1685
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Use default tox pip install
......................................................................
Use default tox pip install
Removing options --process-dependency-links --pre on main testenv, which is effective on other testenvs and installs a pre-release of flake8 that is incompatible with flake-putty.
Bug: T138691
Change-Id: I0efc02ba536d88a503555fd4de30ad6b835dbbec
---
M tox.ini
1 file changed, 0 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tox.ini b/tox.ini
index a7e3021..bc027d7 100644
--- a/tox.ini
+++ b/tox.ini
@@ -20,7 +20,6 @@
PYWIKIBOT2_NO_USER_CONFIG=2
usedevelop = True
commands = python setup.py test
-install_command = pip install --process-dependency-links --pre {opts} {packages}
[testenv:py26]
deps = unittest2
--
To view, visit https://gerrit.wikimedia.org/r/296079
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0efc02ba536d88a503555fd4de30ad6b835dbbec
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [doc] remove unsupported -f option
......................................................................
[doc] remove unsupported -f option
- -f option is not supported but well known -family option could be used
- -o option does the same as common -lang option
Bug: T137274
Change-Id: Iaa0eb7524baef654687905c0296217ff4e13d6d3
---
M scripts/replicate_wiki.py
1 file changed, 7 insertions(+), 3 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/replicate_wiki.py b/scripts/replicate_wiki.py
index 44b37af..fd27032 100755
--- a/scripts/replicate_wiki.py
+++ b/scripts/replicate_wiki.py
@@ -5,7 +5,11 @@
Example:
- python pwb.py replicate_wiki [-r] -ns 10 -f wikipedia -o nl li fy
+ python pwb.py replicate_wiki [-r] -ns 10 -family:wikipedia -o nl li fy
+
+or
+
+ python pwb.py replicate_wiki [-r] -ns 10 -family:wikipedia -lang:nl li fy
to copy all templates from an nlwiki to liwiki and fywiki. It will show which
pages have to be changed if -r is not present, and will only actually write
@@ -26,7 +30,7 @@
--replace you will only get an overview page)
-o original wiki
---original
+--original (you may use -lang:<code> option instead)
destination_wiki destination wiki(s)
@@ -38,7 +42,7 @@
"""
#
# (C) Kasper Souren, 2012-2013
-# (C) Pywikibot team, 2013-2014
+# (C) Pywikibot team, 2013-2016
#
# Distributed under the terms of the MIT license.
#
--
To view, visit https://gerrit.wikimedia.org/r/293906
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaa0eb7524baef654687905c0296217ff4e13d6d3
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: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] rstrip() strings before comparing for changes
......................................................................
[bugfix] rstrip() strings before comparing for changes
- mw does no edit when trying to add spaces or newlines at the end of a page.
userPut() should reflect this point and should not try to show diff and
should not try to edit the page. Finally the result of the method must not
be True.
Bug: T137637
Change-Id: I4958cba789f8a0e997a0dee1204b0d1119bd1931
---
M pywikibot/bot.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 378f2b2..3558e99 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1278,7 +1278,7 @@
@return: whether the page was saved successfully
@rtype: bool
"""
- if oldtext == newtext:
+ if oldtext.rstrip() == newtext.rstrip():
pywikibot.output(u'No changes were needed on %s'
% page.title(asLink=True))
return
--
To view, visit https://gerrit.wikimedia.org/r/293905
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4958cba789f8a0e997a0dee1204b0d1119bd1931
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
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: jenkins-bot <>