Page MenuHomePhabricator

FilePage.file_is_shared raises NoPageError instead of returning False
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

fp = pywikibot.FilePage(s, 'Runaway Cover.png')
fp
FilePage('Datei:Runaway Cover.png')
fp.exists()
False
fp.file_is_shared()

What happens?:

Traceback (most recent call last):
  File "<pyshell#15>", line 1, in <module>
    fp.file_is_shared()
  File "C:\pwb\GIT\core\pywikibot\page\_pages.py", line 2459, in file_is_shared
    return self.latest_file_info.url.startswith(
  File "C:\pwb\GIT\core\pywikibot\page\_pages.py", line 2374, in latest_file_info
    self.site.loadimageinfo(self, history=True)
  File "C:\pwb\GIT\core\pywikibot\site\_apisite.py", line 1272, in loadimageinfo
    self._update_page(page, query, verify_imageinfo=True)
  File "C:\pwb\GIT\core\pywikibot\site\_apisite.py", line 1206, in _update_page
    raise NoPageError(page)
pywikibot.exceptions.NoPageError: Page [[de:Datei:Runaway Cover.png]] doesn't exist.

What should have happened instead?:
return False if file is not shared

>>> fp.file_is_shared()
False

Software version:
Pywikibot 3.0 - 7.2

Details

Event Timeline

Xqt triaged this task as High priority.

Change 775922 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [fix] Don't raise NoPageError with file_is_shared

https://gerrit.wikimedia.org/r/775922

Change 775922 merged by jenkins-bot:

[pywikibot/core@master] [fix] Don't raise NoPageError with file_is_shared

https://gerrit.wikimedia.org/r/775922