jenkins-bot merged this change.
Make WikibaseEntity.concept_uri raise when id isn't known
Change-Id: Ib17d4f86ae3c58a730e7d43cb411c146344ed417
---
M pywikibot/page.py
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/pywikibot/page.py b/pywikibot/page.py
index c408295..b9f4f35 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3841,9 +3841,15 @@
return {}
def concept_uri(self):
- """Return the full concept URI."""
- # todo: raise when self.id is -1
- return '{0}{1}'.format(self.repo.concept_base_uri, self.id)
+ """
+ Return the full concept URI.
+
+ @raise NoWikibaseEntity: if this entity doesn't exist
+ """
+ entity_id = self.getID()
+ if entity_id == '-1':
+ raise pywikibot.NoWikibaseEntity(self)
+ return '{0}{1}'.format(self.repo.concept_base_uri, entity_id)
class WikibasePage(BasePage, WikibaseEntity):
To view, visit change 572498. To unsubscribe, or for help writing mail filters, visit settings.