jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/364117 )
Change subject: [DNM] Add support for item without link to harvest_template
......................................................................
[DNM] Add support for item without link to harvest_template
Bug: T64014
Change-Id: I71f6857ca6ca4a322444182d19177c4ed9483181
---
M scripts/harvest_template.py
1 file changed, 4 insertions(+), 9 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py
index 93ff8a3..bfcc6ac 100755
--- a/scripts/harvest_template.py
+++ b/scripts/harvest_template.py
@@ -101,8 +101,6 @@
return titles
def _template_link_target(self, item, link_text):
- linked_page = None
-
link = pywikibot.Link(link_text)
linked_page = pywikibot.Page(link)
@@ -175,14 +173,11 @@
if claim.type == 'wikibase-item':
# Try to extract a valid page
match = re.search(pywikibot.link_regex, value)
- if not match:
- pywikibot.output(
- '%s field %s value %s is not a '
- 'wikilink. Skipping.'
- % (claim.getID(), field, value))
- continue
+ if match:
+ link_text = match.group(1)
+ else:
+ link_text = value
- link_text = match.group(1)
linked_item = self._template_link_target(
item, link_text)
if not linked_item:
--
To view, visit
https://gerrit.wikimedia.org/r/364117
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I71f6857ca6ca4a322444182d19177c4ed9483181
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>