Skip to content

Commit

Permalink
Merge "Deprecate site.has_transcluded_data"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Feb 19, 2017
2 parents e05b57b + 5927889 commit d059c16
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
8 changes: 4 additions & 4 deletions pywikibot/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"""
#
# (C) Pywikibot team, 2008-2016
# (C) Pywikibot team, 2008-2017
#
# Distributed under the terms of the MIT license.
#
Expand Down Expand Up @@ -3974,9 +3974,9 @@ def fromPage(cls, page, lazy_load=False):
@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)

Expand Down
5 changes: 3 additions & 2 deletions pywikibot/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down Expand Up @@ -2742,9 +2742,10 @@ def has_data_repository(self):
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."""
Expand Down
4 changes: 2 additions & 2 deletions scripts/interwiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -1732,7 +1732,7 @@ def finish(self):
# 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):
Expand Down
6 changes: 3 additions & 3 deletions tests/aspects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1344,14 +1344,14 @@ def setUpClass(cls):
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']))


Expand Down
4 changes: 2 additions & 2 deletions tests/wikibase_tests.py
Original file line number Diff line number Diff line change
@@ -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.
#
Expand Down Expand Up @@ -1234,7 +1234,7 @@ def test_not_supported_family(self, key):
self.assertRaises(pywikibot.WikiBaseError,
ItemPage.fromPage, self.wdp)
self.assertRaisesRegex(pywikibot.WikiBaseError,
'no transcluded data',
'no data repository',
self.wdp.data_item)


Expand Down

0 comments on commit d059c16

Please sign in to comment.