Page MenuHomePhabricator

fileIsShared fails on Wikimedia site linked to Commons
Closed, ResolvedPublic

Description

The following snippet:

import pywikibot
itwp = pywikibot.Site('it', 'wikipedia')
title = 'File:Sepp Maier 1.JPG'
pywikibot.ImagePage(itwp, title).fileIsShared()

should return True. However, after https://github.com/wikimedia/pywikibot-core/commit/faf69ed5281c8da06f155711777bbea67d92f00a#diff-6db52cb863a71de75beda6cf2e90e235R1825, it now raises

pywikibot.ImagePage(itwp, title).fileIsShared()

Traceback (most recent call last):

File "<stdin>", line 1, in <module>
File "/home/valhallasw/src/pywikibot-core/pywikibot/page.py", line 1864, in fileIsShared
  raise pywikibot.NoPage(self)

pywikibot.exceptions.NoPage: Page [[it:File:Sepp Maier 1.JPG]] doesn't exist.


Version: core-(2.0)
Severity: normal

Details

Reference
bz70494

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:54 AM
bzimport set Reference to bz70494.

Change 158921 had a related patch set uploaded by John Vandenberg:
fileIsShared fails on sites with shared file repo

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

Change 158921 merged by jenkins-bot:
fileIsShared fails on sites with shared file repo

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

That fixed 'itwp.fileIsShared' for a shared file.

However should 'commons.fileIsShared' for a non-local file return False instead of raise NoPage?

on itwiki, it should:

  • return False if the file is local,
  • return True if the file is on commons, and
  • raise NoPage if the file doesn't exist at all

What's the point of fileIsShared otherwise?

I believe it now does all of those (itwiki) that after the previous commit.

Clarifying my question:

On commonswiki, with the FilePage with a title that is *only* on itwp, should it
a) return False, or
b) raise NoPage

@Merlijn van Deen are you happy with the current implementation?

@valhallasw , can you check that file_tests.py does what you expect and we can close this task; see also question above..?