Xqt added a comment.

  In T241413#5803709 <https://phabricator.wikimedia.org/T241413#5803709>, @Mpaa 
wrote:
  
  > To understand the wanted behaviour, what is the wanted Site for a 
redirected 'code'?
  > Site('aa', 'wikisource') = ?
  > E.g. APISite("mul", "wikisource")?
  > What is the wanted tuple (site.lang, site.code)?
  > For 'mul', today it is ('en', 'mul').
  
  Currently the test given above fails after a lot of of domain were added to 
siteinfo where the domain does not exists like aa.wikisource.org:
  
    # test an existing site
    >>> import pwb, pywikibot as py
    >>> s = py.Site('de', 'wikisource')
    >>> s
    APISite("de", "wikisource")
    >>> s.hostname()
    'de.wikisource.org'
    
    # check 'mul'
    >>> s = py.Site('mul', 'wikisource')
    >>> s
    APISite("mul", "wikisource")
    >>> s.hostname()
    'wikisource.org'
    
    # '-' is redirected to 'mul' but gives a Userwarning
    >>> s = py.Site('-', 'wikisource')
    WARNING: <pyshell#16>:1: UserWarning: Site wikisource:mul instantiated 
using different code "-"
    
    >>> s
    APISite("mul", "wikisource")
    >>> s.hostname()
    'wikisource.org'
    
    ### 'al' fails but redirection like in '-' should be expected ###
    >>> s = py.Site('al', 'wikisource')
    Traceback (most recent call last):
      File "<pyshell#22>", line 1, in <module>
        s = py.Site('al', 'wikisource')
      File "C:\pwb\GIT\core\pywikibot\__init__.py", line 1271, in Site
        _sites[key] = interface(code=code, fam=fam, user=user, sysop=sysop)
      File "C:\pwb\GIT\core\pywikibot\site.py", line 1832, in __init__
        BaseSite.__init__(self, code, fam, user, sysop)
      File "C:\pwb\GIT\core\pywikibot\site.py", line 775, in __init__
        raise UnknownSite("Language '%s' does not exist in family %s"
    pywikibot.exceptions.UnknownSite: Language 'al' does not exist in family 
wikisource
  
  Didn't make deeper thoughts about the implementation. Just proposed to fix 
the test that it do not fail any longer (make Travis run again) because the 
problem is known and tagged here to be solved finally (or in several steps if 
necessary).

TASK DETAIL
  https://phabricator.wikimedia.org/T241413

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Xqt
Cc: Mpaa, Aklapper, Dvorapa, Liuxinyu970226, Xqt, pywikibot-bugs-list, 
Zkhalido, Hook696, Daryl-TTMG, RomaAmorRoma, 0010318400, E.S.A-Sheild, 
Meekrab2012, joker88john, Viztor, CucyNoiD, NebulousIris, Wenyi, Gaboe420, 
Versusxo, Majesticalreaper22, Giuliamocci, Adrian1985, Cpaulf30, Af420, 
Darkminds3113, Bsandipan, Lordiis, Adik2382, Th3d3v1ls, Ramalepe, Liugev6, 
Tbscho, MayS, WSH1906, Lewizho99, Mdupont, JJMC89, Maathavan, Altostratus, 
Avicennasis, mys_721tx, jayvdb, Masti, Alchimista, Rxy, Krenair
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to