jenkins-bot has submitted this change and it was merged.
Change subject: Expose the concept url of an ItemPage
......................................................................
Expose the concept url of an ItemPage
The siteinfo parameter was introduced in 8ef8d6bf9159e5a4cbf9ebfa2286e7599485662b
and deployed as part of 1.28/wmf.23.
This is part 1 of 3 of the commits to allow unit ItemPages
to be passed to WbQuantity.
Bug: T143594
Change-Id: Ie1e67484351e482b33d6a0faf44c388d20d462a5
---
M pywikibot/page.py
M pywikibot/site.py
2 files changed, 16 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index fbab94f..93c36f5 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3939,6 +3939,11 @@
data['sitelinks'] = self.sitelinks
return data
+ @pywikibot.site.need_version("1.28-wmf.23")
+ def concept_url(self):
+ """Return the full concept URL."""
+ return '{0}{1}'.format(self.site.concept_base_uri, self.id)
+
def getRedirectTarget(self):
"""Return the redirect target for this page."""
target = super(ItemPage, self).getRedirectTarget()
diff --git a/pywikibot/site.py b/pywikibot/site.py
index f997020..780b48b 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -7032,6 +7032,17 @@
'%r does not support entity type "property"'
% self)
+ @property
+ @need_version("1.28-wmf.23")
+ def concept_base_uri(self):
+ """
+ Return the base uri for concepts/entities.
+
+ @return: concept base uri
+ @rtype: str
+ """
+ return self.siteinfo['general']['wikibase-conceptbaseuri']
+
def _get_baserevid(self, claim, baserevid):
"""Check that claim.on_item is set and matches baserevid if
used."""
if not claim.on_item:
--
To view, visit
https://gerrit.wikimedia.org/r/319834
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie1e67484351e482b33d6a0faf44c388d20d462a5
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Lokal Profil <lokal.profil(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>