jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/571919 )
Change subject: [bugfix] Force login for TestShortLink
......................................................................
[bugfix] Force login for TestShortLink
Some IPs of Travis and Appveyor are blocked globally and on local sites.
Creating short links may raise urlshortener-blocked APIError for blocked
IPs. To pass these tests the test account must be logged in.
Bug: T244062
Change-Id: Ia8e5b77ccd24cb0c3e608b163e4a549ac2f54c57
---
M tests/page_tests.py
1 file changed, 2 insertions(+), 0 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/page_tests.py b/tests/page_tests.py
index 23c13c4..ad86eaf 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -1181,6 +1181,8 @@
class TestShortLink(DefaultSiteTestCase):
"""Test that short link management is correct."""
+ user = True
+
family = 'wikipedia'
code = 'test'
--
To view, visit https://gerrit.wikimedia.org/r/571919
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia8e5b77ccd24cb0c3e608b163e4a549ac2f54c57
Gerrit-Change-Number: 571919
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/571852 )
Change subject: [FIX] Correctly choose primary coordinates in BasePage.coordinates()
......................................................................
[FIX] Correctly choose primary coordinates in BasePage.coordinates()
Bug: T244963
Change-Id: Ic47e75b5d04848ac45f2ab7a994a6d4361a1142d
---
M pywikibot/__init__.py
M pywikibot/data/api.py
M pywikibot/page.py
3 files changed, 8 insertions(+), 8 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index c8a66dc..e5aaf8a 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -254,18 +254,14 @@
class Coordinate(_WbRepresentation):
- """
- Class for handling and storing Coordinates.
-
- For now its just being used for DataSite, but
- in the future we can use it for the GeoData extension.
- """
+ """Class for handling and storing Coordinates."""
_items = ('lat', 'lon', 'entity')
@_deprecate_arg('entity', 'globe_item')
def __init__(self, lat, lon, alt=None, precision=None, globe=None,
- typ='', name='', dim=None, site=None, globe_item=None):
+ typ='', name='', dim=None, site=None, globe_item=None,
+ primary=False):
"""
Represent a geo coordinate.
@@ -290,6 +286,8 @@
of this Wikibase item. Takes precedence over 'globe'
if present.
@type globe_item: pywikibot.ItemPage or str
+ @param primary: True for a primary set of coordinates
+ @type primary: bool
"""
self.lat = lat
self.lon = lon
@@ -300,6 +298,7 @@
self.name = name
self._dim = dim
self.site = site or Site().data_repository()
+ self.primary = primary
if globe:
globe = globe.lower()
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 79cb0f7..a75b09e 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -3301,6 +3301,7 @@
name=co.get('name', ''),
dim=int(co.get('dim', 0)) or None,
globe=co['globe'], # See [[gerrit:67886]]
+ primary=True if 'primary' in co else False
)
coords.append(coord)
page._coords = coords
diff --git a/pywikibot/page.py b/pywikibot/page.py
index d585648..1e6746a 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1673,7 +1673,7 @@
self._coords = []
self.site.loadcoordinfo(self)
if primary_only:
- return self._coords[0] if len(self._coords) > 0 else None
+ return [coord for coord in self._coords if coord.primary]
else:
return self._coords
--
To view, visit https://gerrit.wikimedia.org/r/571852
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic47e75b5d04848ac45f2ab7a994a6d4361a1142d
Gerrit-Change-Number: 571852
Gerrit-PatchSet: 2
Gerrit-Owner: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/571730 )
Change subject: [bugfix] userinfo is required for user name or IP no
......................................................................
[bugfix] userinfo is required for user name or IP no
also fix api_tests.py for Fake error message
Bug: T244062
Change-Id: Ia0a7f4cfbcba08b1a0b86fa84f72577bd2cc8466
---
M pywikibot/data/api.py
M tests/api_tests.py
2 files changed, 3 insertions(+), 3 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index bd169d9..79cb0f7 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -2075,8 +2075,8 @@
if self.site.user():
result['error']['current user'] = self.site.user()
else: # not logged in; show the IP
- si = self.site.siteinfo
- result['error']['current user'] = si['name']
+ uinfo = self.site.userinfo
+ result['error']['current user'] = uinfo['name']
# raise error
try:
diff --git a/tests/api_tests.py b/tests/api_tests.py
index 07e6360..ca3a076 100644
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -98,7 +98,7 @@
'API error internal_api_error_fake: Fake error message')
pywikibot.error.assert_called_with(
'Detected MediaWiki API exception internal_api_error_fake: '
- 'Fake error message [servedby:unittest]; raising')
+ 'Fake error message\n[servedby:unittest]; raising')
finally:
self.warning_patcher.stop()
self.error_patcher.stop()
--
To view, visit https://gerrit.wikimedia.org/r/571730
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia0a7f4cfbcba08b1a0b86fa84f72577bd2cc8466
Gerrit-Change-Number: 571730
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/571695 )
Change subject: [tests] Show additional informations with "urlshortener-blocked" APIError
......................................................................
[tests] Show additional informations with "urlshortener-blocked" APIError
- add site and user to the result['error'] dict in case of T244062
- if not logged in, site.user() is None; show the IP in that case
- print "other" information in separate lines with APIError
Bug: T244062
Change-Id: Ia4399c33e751922f105e17968419dd4bb69d1246
---
M pywikibot/data/api.py
1 file changed, 12 insertions(+), 3 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 8cccf44..bd169d9 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -120,11 +120,11 @@
def __str__(self):
"""Return a string representation."""
if self.other:
- return '{0}: {1} [{2}]'.format(
+ return '{0}: {1}\n[{2}]'.format(
self.code,
self.info,
- '; '.join(
- '{0}:{1}'.format(key, val)
+ ';\n '.join(
+ '{0}: {1}'.format(key, val)
for key, val in self.other.items()))
return '{0}: {1}'.format(self.code, self.info)
@@ -2069,6 +2069,15 @@
self.wait()
continue
+ if code == 'urlshortener-blocked': # T244062
+ # add additional informations to result['error']
+ result['error']['current site'] = self.site
+ if self.site.user():
+ result['error']['current user'] = self.site.user()
+ else: # not logged in; show the IP
+ si = self.site.siteinfo
+ result['error']['current user'] = si['name']
+
# raise error
try:
# Due to bug T66958, Page's repr may return non ASCII bytes
--
To view, visit https://gerrit.wikimedia.org/r/571695
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia4399c33e751922f105e17968419dd4bb69d1246
Gerrit-Change-Number: 571695
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/571674 )
Change subject: [bugfix] Use current_page.site instead of self.site
......................................................................
[bugfix] Use current_page.site instead of self.site
With MultipleSitesBot self.site shouldn't be used. Page.site is
required instead.
Bug: T244962
Change-Id: If74897cd2e0bf176703017664074335eb20b9493
---
M scripts/delete.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/delete.py b/scripts/delete.py
index 8803b8c..72b0be2 100755
--- a/scripts/delete.py
+++ b/scripts/delete.py
@@ -214,8 +214,8 @@
self.current_page, ns_names))
return # Not an orphan, do not delete.
- if self.site.user() is None:
- self.site.login()
+ if self.current_page.site.user() is None:
+ self.current_page.site.login()
self.current_page.delete(self.summary,
not self.getOption('always'),
self.getOption('always'),
--
To view, visit https://gerrit.wikimedia.org/r/571674
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If74897cd2e0bf176703017664074335eb20b9493
Gerrit-Change-Number: 571674
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/570994 )
Change subject: [bugfix] Rewrite APISite.page_can_be_edited
......................................................................
[bugfix] Rewrite APISite.page_can_be_edited
site.py:
- Add a new action parameter to page_can_be_edited which reflects
wgRestrictionTypes.
- raise a ValueError if an invalid action parameter is given
- add a dict of special case protection levels and the needed edit right
- the modified method also works for closed wikis
page.py:
- rename "canBeEdited" method to "has_permission" and enable the action
parameter to give a restiction type
- deprecate the old method.
others:
- update other scrips to use the new has_permissionmethod
Bug: T244604
Change-Id: If1eb697a1aadbbd8fe76ede6da01637363ecc5a0
---
M pywikibot/page.py
M pywikibot/site.py
M pywikibot/specialbots.py
M scripts/blockpageschecker.py
M scripts/reflinks.py
M scripts/replace.py
M tests/page_tests.py
7 files changed, 51 insertions(+), 42 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index af90868..48ff258 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1141,17 +1141,24 @@
p_types.remove('upload')
return p_types
- def canBeEdited(self):
- """
- Determine whether the page may be edited.
+ def has_permission(self, action='edit'):
+ """Determine whetherthe page can be modified.
- This returns True if and only if:
- - page is unprotected, and bot has an account for this site, or
- - page is protected, and bot has a sysop account for this site.
+ Return True if the bot has the permission of needed restriction level
+ for the given action type.
+ @param action: a valid restriction type like 'edit', 'move'
+ @type action: str
@rtype: bool
+
+ @raises ValueError: invalid action parameter
"""
- return self.site.page_can_be_edited(self)
+ return self.site.page_can_be_edited(self, action)
+
+ @deprecated("Page.has_permission('edit')", since='20200208')
+ def canBeEdited(self):
+ """DEPRECATED. Determine whether the page may be edited."""
+ return self.has_permission()
def botMayEdit(self):
"""
@@ -2163,7 +2170,7 @@
if cat not in cats:
cats.append(cat)
- if not self.canBeEdited():
+ if not self.has_permission():
pywikibot.output("Can't edit %s, skipping it..."
% self.title(as_link=True))
return False
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 0ad71fe..1371935 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3115,23 +3115,35 @@
self.loadpageinfo(page)
return page._protection
- def page_can_be_edited(self, page):
- """
- Determine if the page can be edited.
+ def page_can_be_edited(self, page, action='edit'):
+ """Determine if the page can be modified.
- Return True if and only if:
- - page is unprotected, and bot has an account for this site, or
- - page is protected, and bot has a sysop account for this site.
+ Return True if the bot has the permission of needed restriction level
+ for the given action type.
+ @param page: a pywikibot.Page object
+ @type param: pywikibot.Page
+ @param action: a valid restriction type like 'edit', 'move'
+ @type action: str
@rtype: bool
+
+ @raises ValueError: invalid action parameter
"""
- rest = self.page_restrictions(page)
- sysop_protected = 'edit' in rest and rest['edit'][0] == 'sysop'
- try:
- api.LoginManager(site=self, sysop=sysop_protected)
- except NoUsername:
- return False
- return True
+ if action not in self.siteinfo['restrictions']['types']:
+ raise ValueError('{}.page_can_be_edited(): Invalid value "{}" for '
+ '"action" parameter'
+ .format(self.__class__.__name__, action))
+ prot_rights = {
+ '': action,
+ 'autoconfirmed': 'editsemiprotected',
+ 'sysop': 'editprotected',
+ 'steward': 'editprotected'
+ }
+ restriction = self.page_restrictions(page).get(action, ('', None))[0]
+ user_rights = self.userinfo['rights']
+ if prot_rights.get(restriction, restriction) in user_rights:
+ return True
+ return False
def page_isredirect(self, page):
"""Return True if and only if page is a redirect."""
@@ -7580,16 +7592,6 @@
'create': ('steward', 'infinity')}
return page._protection
- def page_can_be_edited(self, page):
- """Determine if the page can be edited."""
- rest = self.page_restrictions(page)
- sysop_protected = 'edit' in rest and rest['edit'][0] == 'steward'
- try:
- api.LoginManager(site=self, sysop=sysop_protected)
- except NoUsername:
- return False
- return True
-
def recentchanges(self, **kwargs):
"""An error instead of pointless API call."""
self._closed_error('No recent changes can be returned.')
diff --git a/pywikibot/specialbots.py b/pywikibot/specialbots.py
index 2bfbed1..2bd4cd1 100644
--- a/pywikibot/specialbots.py
+++ b/pywikibot/specialbots.py
@@ -3,7 +3,7 @@
"""Library containing special bots."""
#
# (C) Rob W.W. Hooft, Andre Engels 2003-2004
-# (C) Pywikibot team, 2003-2019
+# (C) Pywikibot team, 2003-2020
#
# Distributed under the terms of the MIT license.
#
@@ -308,7 +308,7 @@
pywikibot.output(
'File exists and you asked to abort. Skipping.')
return None
- if potential_file_page.canBeEdited():
+ if potential_file_page.has_permission():
if overwrite is None:
overwrite = not pywikibot.input_yn(
'File with name %s already exists. '
diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index 0837ada..ec7488f 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -44,7 +44,7 @@
# (C) Monobi a.k.a. Wikihermit, 2007
# (C) Filnik, 2007-2011
# (C) Nicolas Dumazet (NicDumZ), 2008-2009
-# (C) Pywikibot team, 2007-2019
+# (C) Pywikibot team, 2007-2020
#
# Distributed under the terms of the MIT license.
#
@@ -309,7 +309,7 @@
# FIXME: This check does not work :
# PreloadingGenerator cannot set correctly page.editRestriction
# (see bug T57322)
- # if not page.canBeEdited():
+ # if not page.has_permission():
# pywikibot.output(
# "%s is sysop-protected : this account can't edit "
# "it! Skipping..." % pagename)
@@ -319,7 +319,7 @@
editRestr = restrictions['edit']
except KeyError:
editRestr = None
- if not page.canBeEdited():
+ if not page.has_permission():
pywikibot.output('%s is protected: '
"this account can't edit it! Skipping..."
% pagename)
diff --git a/scripts/reflinks.py b/scripts/reflinks.py
index a147fd6..85c0205 100755
--- a/scripts/reflinks.py
+++ b/scripts/reflinks.py
@@ -39,7 +39,7 @@
¶ms;
"""
# (C) Nicolas Dumazet (NicDumZ), 2008
-# (C) Pywikibot team, 2008-2019
+# (C) Pywikibot team, 2008-2020
#
# Distributed under the terms of the MIT license.
#
@@ -515,7 +515,7 @@
try:
# Load the page's text from the wiki
new_text = page.get()
- if not page.canBeEdited():
+ if not page.has_permission():
pywikibot.output("You can't edit page "
+ page.title(as_link=True))
continue
diff --git a/scripts/replace.py b/scripts/replace.py
index 1c30090..e3e9f01 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -137,7 +137,7 @@
"""
#
# (C) Daniel Herding, 2004-2012
-# (C) Pywikibot team, 2004-2019
+# (C) Pywikibot team, 2004-2020
#
# Distributed under the terms of the MIT license.
#
@@ -728,7 +728,7 @@
try:
# Load the page's text from the wiki
original_text = page.get(get_redirect=True)
- if not page.canBeEdited():
+ if not page.has_permission():
pywikibot.output("You can't edit page "
+ page.title(as_link=True))
continue
diff --git a/tests/page_tests.py b/tests/page_tests.py
index 1b7cbf1..23c13c4 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Tests for the page module."""
#
-# (C) Pywikibot team, 2008-2019
+# (C) Pywikibot team, 2008-2020
#
# Distributed under the terms of the MIT license.
#
@@ -464,7 +464,7 @@
r'use interwiki\.page_empty_check\(page\) instead\.'):
self.assertIsInstance(mainpage.isEmpty(), bool)
self.assertIsInstance(mainpage.isDisambig(), bool)
- self.assertIsInstance(mainpage.canBeEdited(), bool)
+ self.assertIsInstance(mainpage.has_permission(), bool)
self.assertIsInstance(mainpage.botMayEdit(), bool)
self.assertIsInstance(mainpage.editTime(), pywikibot.Timestamp)
self.assertIsInstance(mainpage.permalink(), basestring)
--
To view, visit https://gerrit.wikimedia.org/r/570994
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If1eb697a1aadbbd8fe76ede6da01637363ecc5a0
Gerrit-Change-Number: 570994
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Lofhi <hiddenidentity(a)protonmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/571535 )
Change subject: [cleanup] Throw a FutureWarning if compat module is used
......................................................................
[cleanup] Throw a FutureWarning if compat module is used
- use FutureWarning instead of DeprecationWarning for this module
- update doc
- update HISTORY.rst
query.py:
- replace multiple deprecate_arg decorators with deprecated_args
- remove last 'back_response' parameter
- remove 'back_response' result after 8 years which was never supported
Bug: T183085
Change-Id: Ie51b5d9a120925048a4ec3c2c3d0a987b13e63b2
---
M HISTORY.rst
M pywikibot/compat/__init__.py
M pywikibot/compat/catlib.py
M pywikibot/compat/query.py
M pywikibot/compat/userlib.py
M tox.ini
6 files changed, 31 insertions(+), 34 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index 3bcdd32..5898f37 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,7 @@
Current release
---------------
+* compat module is deprecated for 5 years and will be removed with next release (T183085)
* ipaddress module is required for Python 2 (T243171)
* tools.ip will be dropped in favour of tools.is_IP (T243171)
* tools.ip_regexp is deprecatd for 5 years and will be removed with next release
diff --git a/pywikibot/compat/__init__.py b/pywikibot/compat/__init__.py
index 1f9845b..eaf5879 100644
--- a/pywikibot/compat/__init__.py
+++ b/pywikibot/compat/__init__.py
@@ -1,2 +1,6 @@
# -*- coding: utf-8 -*-
-"""Package to provide compatibility with compat scripts."""
+"""
+WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE COMPAT BACKWARDS-COMPATIBILITY.
+
+IT IS DEPRECATED. DO NOT USE IT.
+"""
diff --git a/pywikibot/compat/catlib.py b/pywikibot/compat/catlib.py
index 1214f95..b7fb4e9 100644
--- a/pywikibot/compat/catlib.py
+++ b/pywikibot/compat/catlib.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
"""
-WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE BACKWARDS-COMPATIBILITY.
+WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE COMPAT BACKWARDS-COMPATIBILITY.
-Do not use in new scripts; use the source to find the appropriate
-function/method instead.
+IT IS DEPRECATED. DO NOT USE IT.
+Do not use this module anymore; use pywikibot.Category class
+or Page.change_category method instead.
"""
#
-# (C) Pywikibot team, 2008-2018
+# (C) Pywikibot team, 2008-2020
#
# Distributed under the terms of the MIT license.
#
@@ -28,7 +29,7 @@
wrapper = ModuleDeprecationWrapper(__name__)
wrapper._add_deprecated_attr('Category',
replacement_name='pywikibot.Category',
- since='20141209')
+ since='20141209', future_warning=True)
wrapper._add_deprecated_attr('change_category',
replacement_name='Page.change_category',
- since='20141209')
+ since='20141209', future_warning=True)
diff --git a/pywikibot/compat/query.py b/pywikibot/compat/query.py
index 830f87a..967db30 100644
--- a/pywikibot/compat/query.py
+++ b/pywikibot/compat/query.py
@@ -1,30 +1,28 @@
# -*- coding: utf-8 -*-
"""
-WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE BACKWARDS-COMPATIBILITY.
+WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE COMPAT BACKWARDS-COMPATIBILITY.
-Do not use in new scripts; use the source to find the appropriate
-function/method instead.
+IT IS DEPRECATED. DO NOT USE IT.
+Do not use this module anymore; use pywikibot.data.api.Request
+or Page/APISite highlevel methods instead.
"""
#
-# (C) Pywikibot team, 2008-2019
+# (C) Pywikibot team, 2008-2020
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, division, unicode_literals
-import pywikibot
from pywikibot.data import api
-from pywikibot.tools import deprecated, deprecate_arg
-
-import io
+from pywikibot.tools import deprecated, deprecated_args, remove_last_args
-@deprecated('pywikibot.data.api.Request', since='20120603')
-@deprecate_arg('useAPI', None)
-@deprecate_arg('retryCount', None)
-@deprecate_arg('encodeTitle', None)
-def GetData(request, site=None, back_response=False):
+@deprecated('pywikibot.data.api.Request', since='20120603',
+ future_warning=True)
+@deprecated_args(useAPI=None, retryCount=None, encodeTitle=None)
+@remove_last_args(['back_response'])
+def GetData(request, site=None):
"""
Query the server with the given request dict.
@@ -34,15 +32,7 @@
request['site'] = site
req = api.Request(**request)
- result = req.submit()
-
- if back_response:
- pywikibot.warning('back_response is no longer supported; an empty '
- 'response object will be returned')
- res_dummy = io.StringIO()
- res_dummy.__dict__.update({'code': 0, 'msg': ''})
- return res_dummy, result
- return result
+ return req.submit()
__all__ = (GetData, )
diff --git a/pywikibot/compat/userlib.py b/pywikibot/compat/userlib.py
index 1c34231..c664d3c 100644
--- a/pywikibot/compat/userlib.py
+++ b/pywikibot/compat/userlib.py
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
"""
-WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE BACKWARDS-COMPATIBILITY.
+WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE COMPAT BACKWARDS-COMPATIBILITY.
-Do not use in new scripts; use the source to find the appropriate
-function/method instead.
+IT IS DEPRECATED. DO NOT USE IT.
+Do not use this module anymore; use pywikibot.User instead.
"""
#
-# (C) Pywikibot team, 2008-2018
+# (C) Pywikibot team, 2008-2020
#
# Distributed under the terms of the MIT license.
#
@@ -21,4 +21,4 @@
wrapper = ModuleDeprecationWrapper(__name__)
wrapper._add_deprecated_attr('User',
replacement_name='pywikibot.User',
- since='20141209')
+ since='20141209', future_warning=True)
diff --git a/tox.ini b/tox.ini
index 8a31790..e11c674 100644
--- a/tox.ini
+++ b/tox.ini
@@ -122,6 +122,7 @@
pywikibot/_wbtypes.py: N802
pywikibot/backports.py: N802
pywikibot/bot.py: N802, N815, N816
+ pywikibot/compat/__init__.py: FI10, FI11, FI14
pywikibot/compat/catlib.py : N803
pywikibot/compat/query.py: N802
pywikibot/config2.py: N816
--
To view, visit https://gerrit.wikimedia.org/r/571535
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie51b5d9a120925048a4ec3c2c3d0a987b13e63b2
Gerrit-Change-Number: 571535
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Lokal Profil <andre.costa(a)wikimedia.se>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)