Page MenuHomePhabricator

Mediawiki.org interwiki is mw or mediawikiwiki, not mediawiki
Open, HighPublic

Description

Steps to reproduce

  1. $ python pwb.py shell
  2. insite = pywikibot.Site('cs') # or whatever else than mediawiki
  3. site = pywikibot.Site('mediawiki', 'mediawiki')
  4. pywikibot.Page(site, 'Page in site', insite=insite)

or

  1. $ python pwb.py shell -family="wikipedia" -lang="cs" # or whatever else than mediawiki
  2. site = pywikibot.Site('mediawiki', 'mediawiki')
  3. pywikibot.Page(site, 'Page in site')

Expected behavior
The link should point from insite to site correctly.

Current behavior
The produced link is red, because it looks like: [[mediawiki:Page in site]], which is not valid mediawiki interwiki. See an example.

Configuration
Python 3.6.4, Pywikibot latest commit in master

Event Timeline

Yes, I can confirm this. Dvorapa already added example which happening on my private wiki. :)

insite parameter of pywikibot.Page uses code of a specified Site. For Mediawiki (single site family) the code is the same as family: mediawiki. But interwiki is only either mediawikiwiki or mw. Therefore insite parameter should get and use interwiki prefix of the specified Site, not the actual code

Liuxinyu970226 renamed this task from Mediawiki interwiki is mw or mediawikiwiki, not mediawiki to Mediawiki.org interwiki is mw or mediawikiwiki, not mediawiki.Feb 24 2018, 9:48 AM
Xqt triaged this task as High priority.Feb 24 2018, 10:03 AM

I never noticed that. Seems this is to differentiate from MediaWiki namespace whereas the interwiki link for commonswiki is commons and the interwiki link for wikidatawiki is wikidata.

Change 414070 had a related patch set uploaded (by Zoranzoki21; owner: Xqt):
[pywikibot/core@master] [bugfix] iw link for mediawiki is mediawikiwiki

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

Page.title()
if insite:
    target_code = insite.code
    target_family = insite.family.name
else:
    target_code = config.mylang
    target_family = config.family
if force_interwiki or \
   (allow_interwiki
    and (self.site.family.name != target_family
         or self.site.code != target_code)):
    if self.site.family.name != target_family \
       and self.site.family.name != self.site.code:
        title = '%s:%s:%s' % (
            self.site.family.name, self.site.code, title)
    else:
        # use this form for sites like commons, where the
        # code is the same as the family name
        title = '%s:%s' % (self.site.code, title)

The last line causes this issue.

In my opinion it should use Site.interwiki_prefix() instead of Site.code (and the lines above too in some way).

Site.interwiki_prefix() needs to be fixed before:

The same issue is for test / testwiki

Change 509538 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [bugfix] Fix mediawikiwiki and testwiki shortcuts

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

Aklapper removed Xqt as the assignee of this task.Jul 2 2021, 5:15 AM

Removing task assignee due to inactivity, as this open task has been assigned for more than two years (see emails sent to assignee on May26 and Jun17, and T270544). Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be very welcome!

(See https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.)