Page MenuHomePhabricator

Pywikibot APISite support for extension Polyglot
Closed, DeclinedPublic

Description

MW extension Polyglot (which doesnt appear to be in Phabricator) creates interlanguage links to the same wiki, and the 'code' doesnt exist in the interwikimap.

'it' is in the langlinks
http://botwiki.sno.cc/w/api.php?action=query&titles=Main_Page&prop=langlinks

'it' isnt in the interwikimap
http://botwiki.sno.cc/w/api.php?action=query&meta=siteinfo&siprop=interwikimap

This is currently causing two tests to fail on botwiki
https://travis-ci.org/jayvdb/pywikibot-core/jobs/68085027

======================================================================
ERROR: testLinks (tests.page_tests.TestPageObject)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/jayvdb/pywikibot-core/tests/page_tests.py", line 469, in testLinks
    for p in mainpage.langlinks():
  File "/home/travis/build/jayvdb/pywikibot-core/pywikibot/page.py", line 1300, in langlinks
    self._langlinks = list(self.iterlanglinks(include_obsolete=True))
  File "/home/travis/build/jayvdb/pywikibot-core/pywikibot/site.py", line 3467, in pagelanglinks
    source=self)
  File "/home/travis/build/jayvdb/pywikibot-core/pywikibot/page.py", line 5022, in langlinkUnsafe
    link._site = pywikibot.Site(lang, source.family.name)
  File "/home/travis/build/jayvdb/pywikibot-core/pywikibot/__init__.py", line 615, in Site
    _sites[key] = interface(code=code, fam=fam, user=user, sysop=sysop)
  File "/home/travis/build/jayvdb/pywikibot-core/pywikibot/site.py", line 1559, in __init__
    BaseSite.__init__(self, code, fam, user, sysop)
  File "/home/travis/build/jayvdb/pywikibot-core/pywikibot/site.py", line 563, in __init__
    % (self.__code, self.__family.name))
UnknownSite: Language 'it' does not exist in family botwiki

======================================================================
ERROR: Test site methods for getting links to and from a page.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/jayvdb/pywikibot-core/tests/site_tests.py", line 448, in testLinkMethods
    for ll in mysite.pagelanglinks(mainpage):
  File "/home/travis/build/jayvdb/pywikibot-core/pywikibot/site.py", line 3467, in pagelanglinks
    source=self)
  File "/home/travis/build/jayvdb/pywikibot-core/pywikibot/page.py", line 5022, in langlinkUnsafe
    link._site = pywikibot.Site(lang, source.family.name)
  File "/home/travis/build/jayvdb/pywikibot-core/pywikibot/__init__.py", line 615, in Site
    _sites[key] = interface(code=code, fam=fam, user=user, sysop=sysop)
  File "/home/travis/build/jayvdb/pywikibot-core/pywikibot/site.py", line 1559, in __init__
    BaseSite.__init__(self, code, fam, user, sysop)
  File "/home/travis/build/jayvdb/pywikibot-core/pywikibot/site.py", line 563, in __init__
    % (self.__code, self.__family.name))
UnknownSite: Language 'it' does not exist in family botwiki

The errors are due to the family file generator explicitly adding 'en' as a code, and no other valid codes.
Simple solutions include the generator not using any codes in the generated file, or manually add 'it' to the family class, pointing at the same URL, and fix whatever breaks.
However these simple solutions are a departure from our intention to use T74873: Family generator detection (tracking). But is this extension ( with ~75 wikis) worth special handling?

Event Timeline

jayvdb raised the priority of this task from to Low.
jayvdb updated the task description. (Show Details)
jayvdb added projects: Pywikibot-tests, Pywikibot.
jayvdb added subscribers: gerritbot, jayvdb, Doug and 5 others.
Xqt subscribed.

Polyglot is still experimental and I can't see any importance to support it

Polyglot went from experimental straight to unmaintained :) I think the last time I touched it was more than ten years ago.