Skip to content

Commit

Permalink
Merge "harvest_template.py: Catch InvalidTitle"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Aug 2, 2017
2 parents d729abf + 723ada2 commit 42e2f7a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/harvest_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ def getTemplateSynonyms(self, title):

def _template_link_target(self, item, link_text):
link = pywikibot.Link(link_text)
linked_page = pywikibot.Page(link)
try:
linked_page = pywikibot.Page(link)
except pywikibot.exceptions.InvalidTitle:
pywikibot.error('%s is not a valid title so it cannot be linked. '
'Skipping.' % link_text)
return

if not linked_page.exists():
pywikibot.output('%s does not exist so it cannot be linked. '
Expand Down

0 comments on commit 42e2f7a

Please sign in to comment.