Last modified: 2014-11-19 21:59:59 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T75534, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 73534 - missing language in family causes exception in Page.langlinks
missing language in family causes exception in Page.langlinks
Status: NEW
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
core-(2.0)
All All
: Unprioritized critical
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks: pwb20
  Show dependency treegraph
 
Reported: 2014-11-17 23:50 UTC by John Mark Vandenberg
Modified: 2014-11-19 21:59 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description John Mark Vandenberg 2014-11-17 23:50:50 UTC
On en.wowwiki:

ERROR: testLinks (tests.page_tests.TestPageObject)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/page_tests.py", line 469, in testLinks
    for p in mainpage.langlinks():
  File "pywikibot/page.py", line 1189, in langlinks
    self._langlinks = list(self.iterlanglinks(include_obsolete=True))
  File "pywikibot/site.py", line 2987, in pagelanglinks
    source=self)
  File "pywikibot/page.py", line 4386, in langlinkUnsafe
    link._site = pywikibot.Site(lang, source.family.name)
  File "pywikibot/__init__.py", line 573, in Site
    _sites[key] = interface(code=code, fam=fam, user=user, sysop=sysop)
  File "pywikibot/site.py", line 1422, in __init__
    BaseSite.__init__(self, code, fam, user, sysop)
  File "pywikibot/site.py", line 451, in __init__
    % (self.__code, self.__family.name))
UnknownSite: Language nn does not exist in family wowwiki
Comment 1 John Mark Vandenberg 2014-11-17 23:57:41 UTC
On en.vikidia

ERROR: testLinks (tests.page_tests.TestPageObject)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/page_tests.py", line 469, in testLinks
    for p in mainpage.langlinks():
  File "pywikibot/page.py", line 1185, in langlinks
    self._langlinks = list(self.iterlanglinks(include_obsolete=True))
  File "pywikibot/site.py", line 2983, in pagelanglinks
    source=self)
  File "pywikibot/page.py", line 4382, in langlinkUnsafe
    link._site = pywikibot.Site(lang, source.family.name)
  File "pywikibot/__init__.py", line 573, in Site
    _sites[key] = interface(code=code, fam=fam, user=user, sysop=sysop)
  File "pywikibot/site.py", line 1422, in __init__
    BaseSite.__init__(self, code, fam, user, sysop)
  File "pywikibot/site.py", line 451, in __init__
    % (self.__code, self.__family.name))
UnknownSite: Language de does not exist in family vikidia
Comment 2 Fabian 2014-11-18 00:19:01 UTC
Well in the case of vikidia it assumes that the language code 'de' is a part of the family, but the Special:Interwiki page reveals that it's actually another wiki (http://grundschulwiki.zum.de/wiki/Hauptseite , although I don't know if they are affiliated): http://en.vikidia.org/wiki/Special:Interwiki

And the mainpage of the English Vikidia shows an interwiki link to 'de:': http://en.vikidia.org/w/index.php?title=Main_Page&action=edit

I'm not sure what the solution there is, because it seems like a method which analyses it without any prior checking. The most flexible way would be to use 'APISite.interwiki()' which would tell that there is no family for grundschulwiki.zum.de.
Comment 3 John Mark Vandenberg 2014-11-18 00:26:43 UTC
(In reply to Fabian from comment #2)
> Well in the case of vikidia it assumes that the language code 'de' is a part
> of the family, but the Special:Interwiki page reveals that it's actually
> another wiki (http://grundschulwiki.zum.de/wiki/Hauptseite , although I
> don't know if they are affiliated):
> http://en.vikidia.org/wiki/Special:Interwiki

They are affiliated.

Wowwiki is the same: the 'family' is split across several domains - see our family file for wowwiki.
Comment 4 Fabian 2014-11-18 00:33:51 UTC
Okay I'm checking the source code about the support for 'from_url'. It currently supports all pages which uses the "<code>.url" scheme which vikidia is not following.

But otherwise it should be possible to just add an entry 'de' to the langs dictionary of vikidata.

It also appears that the wowwiki family also needs to be checked if they support 'from_url'.
Comment 5 Fabian 2014-11-18 00:46:22 UTC
Okay nevermind, from_url is flexible enough for that, so are there any caveats by simply adding the missing languages?
Comment 6 John Mark Vandenberg 2014-11-18 02:01:14 UTC
The problem is that adding missing languages isnt possible after the library is released into pypi.  Options include:
1. automatically find new subdomains in the Family layer (e.g. https://gerrit.wikimedia.org/r/#/c/171616/), or
2. Load Site objects which are not in Family.langs (https://gerrit.wikimedia.org/r/#/c/170931/), or
3. dont package family files with the library on pypi.  They could be a separate package. (this sounds like it should be done anyway).
Comment 7 Fabian 2014-11-18 02:10:12 UTC
Well we (or pywikibot for that matter) can't know if a site is a part of a family. How could we know that the site linked with 'de' on en.vikidia is in the same family as vikidia itself.

We could assume that ISO language codes are part of the family, as those are by default shown on the sidbar. But apart from that we don't: e.g. test.wikidata which is in the wikidata family.
Comment 8 John Mark Vandenberg 2014-11-19 21:59:59 UTC
Assuming ISO language codes are part of the family would be quite a sophisticated strategy.  That type of logic would be easily applied when creating the Link object; e.g. creating a Link object even if no Site object can be created.

A dumber version of that is for the family to register multiple domains / regexes in a class variables, and the family class then assumes any matching domain name is a member of the family, and create Site objects accordingly.

I expect we want to add a few classes to help us group types of families, and the functionality they contain.  The most distinct type of family is the one with ISO codes for different languages of the project.  MutlilangFamily / ISOLangFamily ?
those families usually include a non-ISO-code project, e.g. meta.anarchopedia.org, beta.wikiversity.org, and www.wikisource.org , however the last two could be/should be given the 'mul' ISO language code, and treated differently of course.
mul.wikiversity.org (doesnt work) and mul.wikisource.org (redirecter only). bug 41807/ bug 62717/ etc.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links