jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/281632 )
Change subject: Deprecate site.has_transcluded_data
......................................................................
Deprecate site.has_transcluded_data
Since Wikidata was deployed to all sites and r11188 [1] was merged
there is no difference between has_transcluded_data and has_data_repository
property. Deprecate the first one and replace them in framework's scripts.
Also change some doc strings related to that including test.
[1]
https://mediawiki.org/wiki/Special:Code/pywikipedia/11188
Change-Id: If898bb5721ce5b29b73b8af5f81e2574242cb501
---
M pywikibot/page.py
M pywikibot/site.py
M scripts/interwiki.py
M tests/aspects.py
M tests/wikibase_tests.py
5 files changed, 14 insertions(+), 13 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 586e907..147cde2 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -12,7 +12,7 @@
"""
#
-# (C) Pywikibot team, 2008-2016
+# (C) Pywikibot team, 2008-2017
#
# Distributed under the terms of the MIT license.
#
@@ -3974,9 +3974,9 @@
@raise NoPage: There is no corresponding ItemPage for the page
"""
- if not page.site.has_transcluded_data:
- raise pywikibot.WikiBaseError(u'%s has no transcluded data'
- % page.site)
+ if not page.site.has_data_repository:
+ raise pywikibot.WikiBaseError('{0} has no data repository'
+ ''.format(page.site))
if not lazy_load and not page.exists():
raise pywikibot.NoPage(page)
diff --git a/pywikibot/site.py b/pywikibot/site.py
index f2724d9..19ba432 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -6,7 +6,7 @@
groups of wikis on the same topic in different languages.
"""
#
-# (C) Pywikibot team, 2008-2016
+# (C) Pywikibot team, 2008-2017
#
# Distributed under the terms of the MIT license.
#
@@ -2742,9 +2742,10 @@
return self.data_repository() is not None
@property
+ @deprecated('has_data_repository')
def has_transcluded_data(self):
"""Return True if site has a shared data repository like
Wikidata."""
- return self.data_repository() is not None
+ return self.has_data_repository
def image_repository(self):
"""Return Site object for image repository e.g.
commons."""
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index baf0c5a..513dd5b 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -336,7 +336,7 @@
# (C) Rob W.W. Hooft, 2003
# (C) Daniel Herding, 2004
# (C) Yuri Astrakhan, 2005-2006
-# (C) xqt, 2009-2014
+# (C) xqt, 2009-2017
# (C) Pywikibot team, 2007-2017
#
# Distributed under the terms of the MIT license.
@@ -1732,7 +1732,7 @@
# if we have an account for this site
if site.family.name in config.usernames and \
site.code in config.usernames[site.family.name] and \
- not site.has_transcluded_data:
+ not site.has_data_repository:
# Try to do the changes
try:
if self.replaceLinks(page, new):
diff --git a/tests/aspects.py b/tests/aspects.py
index 993f9cd..edc4817 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -1343,14 +1343,14 @@
Set up the test class.
Checks that all sites are configured as a Wikibase client,
- with Site.has_transcluded_data() returning True.
+ with Site.has_data_repository returning True.
"""
super(WikibaseClientTestCase, cls).setUpClass()
for site in cls.sites.values():
- if not site['site'].has_transcluded_data:
+ if not site['site'].has_data_repository:
raise unittest.SkipTest(
- u'%s: %r does not have transcluded data'
+ '%s: %r does not have data repository'
% (cls.__name__, site['site']))
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 0aaad45..b00817b 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Tests for the Wikidata parts of the page module."""
#
-# (C) Pywikibot team, 2008-2016
+# (C) Pywikibot team, 2008-2017
#
# Distributed under the terms of the MIT license.
#
@@ -1234,7 +1234,7 @@
self.assertRaises(pywikibot.WikiBaseError,
ItemPage.fromPage, self.wdp)
self.assertRaisesRegex(pywikibot.WikiBaseError,
- 'no transcluded data',
+ 'no data repository',
self.wdp.data_item)
--
To view, visit
https://gerrit.wikimedia.org/r/281632
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If898bb5721ce5b29b73b8af5f81e2574242cb501
Gerrit-PatchSet: 7
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>