jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/574244 )
Change subject: [doc] Update HISTORY.rst
......................................................................
[doc] Update HISTORY.rst
Change-Id: If28d7ee5de1f7135515ebdc7f538bb42fd1ad698
---
M HISTORY.rst
1 file changed, 5 insertions(+), 0 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index af1379e..771d833 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,7 +4,12 @@
Current release
---------------
+* Let Site('test', 'test) be equal to Site('test', 'wikipedia') (T228839)
* Support of MediaWiki releases below 1.19 will be dropped (T245350)
+* Provide mediawiki_messages for foreign language codes
+* Use mw API IP/anon user detection (T245318)
+* Correctly choose primary coordinates in BasePage.coordinates() (T244963)
+* Rewrite APISite.page_can_be_edited (T244604)
* 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)
--
To view, visit https://gerrit.wikimedia.org/r/574244
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: If28d7ee5de1f7135515ebdc7f538bb42fd1ad698
Gerrit-Change-Number: 574244
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/574175 )
Change subject: [IMPR] Get geo-shape and tabular-data repositories via API
......................................................................
[IMPR] Get geo-shape and tabular-data repositories via API
This has been possible since T162561 and T164413 were resolved.
Change-Id: I0607f05416c8060fd34201f73687c7a0c5451964
---
M pywikibot/families/wikidata_family.py
M pywikibot/site.py
2 files changed, 12 insertions(+), 19 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/families/wikidata_family.py b/pywikibot/families/wikidata_family.py
index e8012c4..4eec5c0 100644
--- a/pywikibot/families/wikidata_family.py
+++ b/pywikibot/families/wikidata_family.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Family module for Wikidata."""
#
-# (C) Pywikibot team, 2012-2018
+# (C) Pywikibot team, 2012-2020
#
# Distributed under the terms of the MIT license.
#
@@ -50,16 +50,6 @@
"""Default calendar model for WbTime datatype."""
return 'http://www.wikidata.org/entity/Q1985727'
- def shared_geo_shape_repository(self, code):
- """Return Wikimedia Commons as the repository for geo-shapes."""
- # Per geoShapeStorageFrontendUrl settings in Wikibase
- return ('commons', 'commons')
-
- def shared_tabular_data_repository(self, code):
- """Return Wikimedia Commons as the repository for tabular-datas."""
- # Per tabularDataStorageFrontendUrl settings in Wikibase
- return ('commons', 'commons')
-
def default_globe(self, code):
"""Default globe for Coordinate datatype."""
return 'earth'
diff --git a/pywikibot/site.py b/pywikibot/site.py
index c629eb5..ca504ed 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -7891,17 +7891,20 @@
def geo_shape_repository(self):
"""Return Site object for the geo-shapes repository e.g. commons."""
- # Do this via API instead when T162561 is implemented.
- code, fam = self.shared_geo_shape_repository()
- if bool(code or fam):
- return pywikibot.Site(code, fam, self.username())
+ url = self.siteinfo['general'].get('wikibase-geoshapestoragebaseurl')
+ if url:
+ return pywikibot.Site(url=url, user=self.username())
+ # todo: should this raise?
+ return None
def tabular_data_repository(self):
"""Return Site object for the tabular-datas repository e.g. commons."""
- # Do this via API instead when T164413 is implemented.
- code, fam = self.shared_tabular_data_repository()
- if bool(code or fam):
- return pywikibot.Site(code, fam, self.username())
+ url = self.siteinfo['general'].get(
+ 'wikibase-tabulardatastoragebaseurl')
+ if url:
+ return pywikibot.Site(url=url, user=self.username())
+ # todo: should this raise?
+ return None
def loadcontent(self, identification, *props):
"""
--
To view, visit https://gerrit.wikimedia.org/r/574175
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: I0607f05416c8060fd34201f73687c7a0c5451964
Gerrit-Change-Number: 574175
Gerrit-PatchSet: 3
Gerrit-Owner: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Lokal Profil <andre.costa(a)wikimedia.se>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.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/574111 )
Change subject: [bugfix] Raise InvalidTitle for title containing illegal char
......................................................................
[bugfix] Raise InvalidTitle for title containing illegal char
+ use the same error message as below in parse()
+ use %r instead of '%s' % repr() in both errors
Bug: T181443
Change-Id: Ie9dafebd0b07fe1467a50eb49976dddf059bc305
---
M pywikibot/page.py
1 file changed, 3 insertions(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 18e41d0..032096e 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -6039,11 +6039,9 @@
t = unicodedata.normalize('NFC', t)
# This code was adapted from Title.php : secureAndSplit()
- #
if '\ufffd' in t:
- raise pywikibot.Error(
- "Title contains illegal char (\\uFFFD 'REPLACEMENT CHARACTER')"
- )
+ raise pywikibot.InvalidTitle(
+ '%r contains illegal char %r' % (t, '\ufffd'))
# Cleanup whitespace
t = re.sub(
@@ -6182,7 +6180,7 @@
m = Link.illegal_titles_pattern.search(t)
if m:
raise pywikibot.InvalidTitle(
- '%s contains illegal char(s) %s' % (repr(t), repr(m.group(0))))
+ '%r contains illegal char(s) %r' % (t, m.group(0)))
# Pages with "/./" or "/../" appearing in the URLs will
# often be unreachable due to the way web browsers deal
--
To view, visit https://gerrit.wikimedia.org/r/574111
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: Ie9dafebd0b07fe1467a50eb49976dddf059bc305
Gerrit-Change-Number: 574111
Gerrit-PatchSet: 8
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/573802 )
Change subject: [bugfix] Fix tests for requests 2.23
......................................................................
[bugfix] Fix tests for requests 2.23
Bug: T245763
Change-Id: Ia38730c1f684c7419845525d1711fd694c910f0e
---
M tests/http_tests.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/http_tests.py b/tests/http_tests.py
index 21f50b8..d456024 100644
--- a/tests/http_tests.py
+++ b/tests/http_tests.py
@@ -204,7 +204,7 @@
# A InvalidSchema is raised within requests
self.assertRaisesRegex(
requests.exceptions.InvalidSchema,
- "No connection adapters were found for 'invalid://url'",
+ "No connection adapters were found for u?'invalid://url'",
http.fetch, uri='invalid://url')
def test_follow_redirects(self):
--
To view, visit https://gerrit.wikimedia.org/r/573802
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: Ia38730c1f684c7419845525d1711fd694c910f0e
Gerrit-Change-Number: 573802
Gerrit-PatchSet: 3
Gerrit-Owner: 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/572250 )
Change subject: [bugfix] let Site('test', 'test) be equal to Site('test', 'wikipedia')
......................................................................
[bugfix] let Site('test', 'test) be equal to Site('test', 'wikipedia')
- update family_tests.py
- also show the deprecation warning as FutureWarning so that
test family can be removed soon.
Bug: T228839
Change-Id: I1f06723699de24b7dfdfba1cc68f601b0922b7c8
---
M pywikibot/families/test_family.py
M tests/family_tests.py
2 files changed, 14 insertions(+), 13 deletions(-)
Approvals:
Framawiki: Looks good to me, but someone else must approve
Mpaa: Looks good to me, approved
Dvorapa: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/families/test_family.py b/pywikibot/families/test_family.py
index 51b4480..afa55b4 100644
--- a/pywikibot/families/test_family.py
+++ b/pywikibot/families/test_family.py
@@ -1,23 +1,18 @@
# -*- coding: utf-8 -*-
"""Family module for test.wikipedia.org."""
#
-# (C) Pywikibot team, 2007-2019
+# (C) Pywikibot team, 2007-2020
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, division, unicode_literals
-from pywikibot.families.wikipedia_family import Family
+from pywikibot.families.wikipedia_family import Family # noqa: F401
from pywikibot.tools import issue_deprecation_warning
issue_deprecation_warning(
- 'test_family', 'wikipedia_family', since='20190718')
-# Also remove the ``if fam == 'test':`` condition in pywikibot.__init__
+ 'test_family', 'wikipedia_family', since='20190718',
+ warning_class=FutureWarning)
+# Also remove the ``if fam == 'test':`` condition in pywikibot.__init__.py
+# and `` == 'test':`` condition in tests.family_tests.py
# whenever this module is removed.
-
-
-class Family(Family):
-
- """Family class for test.wikipedia.org."""
-
- name = 'test'
diff --git a/tests/family_tests.py b/tests/family_tests.py
index 28c5007..f127794 100644
--- a/tests/family_tests.py
+++ b/tests/family_tests.py
@@ -51,7 +51,10 @@
self.assertIsInstance(domain, basestring)
if domain.split(':', 1)[0] != 'localhost':
self.assertIn('.', domain)
- self.assertEqual(f.name, name)
+ if name == 'test':
+ self.assertEqual(f.name, 'wikipedia')
+ else:
+ self.assertEqual(f.name, name)
with suppress_warnings(
'wowwiki_family.Family.languages_by_size '
@@ -176,7 +179,10 @@
self.assertEqual(args, ())
self.assertEqual(kwargs, {})
self.assertEqual(code, self.current_code)
- self.assertEqual(fam, self.current_family)
+ if self.current_family == 'test':
+ self.assertEqual(fam, 'wikipedia')
+ else:
+ self.assertEqual(fam, self.current_family)
site = DrySite(code, fam, None)
site._siteinfo._cache['general'] = ({'articlepath': self.article_path},
True)
--
To view, visit https://gerrit.wikimedia.org/r/572250
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: I1f06723699de24b7dfdfba1cc68f601b0922b7c8
Gerrit-Change-Number: 572250
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)