Page MenuHomePhabricator

pywikibot.Link.langlinkUnsafe can't deal with obsolete sites
Closed, ResolvedPublic

Description

print list(pywikibot.Page(pywikibot.getSite("af"), "Maan").iterlanglinks())
raises NoSuchSite exception

I actually encountered this problem when I ran featured.py. It seems that there is an attempt (gerrit: 112322) to fix this problem, but the problem still persists.


Version: core-(2.0)
Severity: normal

Details

Reference
bz61120

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:55 AM
bzimport set Reference to bz61120.
bzimport added a subscriber: Unknown Object (????).

Oh! I forgot to mention that the above code fails because iterlanglinks() will call pywikibot.Link.langlinkUnsafe.

There are two places calling pywikibot.Link.langlinkUnsafe: in iterlanglinks() and in update_page() from api.py. I don't which way is better between putting try-except block inside pywikibot.Link.langlinkUnsafe directly, and putting try-except block in caller functions over pywikibot.Link.langlinkUnsafe.

Change 112842 had a related patch set uploaded by Nullzero:
Prevent NoSuchSite error from reading obsolete site's language link

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

Change 112842 merged by jenkins-bot:
Make obsolete site object can be created

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