Matěj Suchánek has uploaded a new change for review. ( 
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(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/17/364117/1

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: newchange
Gerrit-Change-Id: I71f6857ca6ca4a322444182d19177c4ed9483181
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to