Last modified: 2014-04-13 14:39:22 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 T58734, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 56734 - Page(site, title).interwiki() doesn't work
Page(site, title).interwiki() doesn't work
Status: NEW
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
compat-(1.0)
All All
: Unprioritized major
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-07 19:32 UTC by Igor Remolar @ Betxí
Modified: 2014-04-13 14:39 UTC (History)
2 users (show)

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


Attachments

Description Igor Remolar @ Betxí 2013-11-07 19:32:53 UTC
I observed that Page(site, title).interwiki() doesn't work.
I think it is because DataPage().get()['link'] returns something like {"nowiki":{"name: "Title", "badges": []}}
and it was expected something like {"nowiki": "Title"}

Another bug i observed is that wikidata gives also the Commons link

I have modified the wikipedia.py line 4719

from "links[code]) for code in links]"
to "links[code]['name']) for code in links if "commons" not in code]"

and it works fine but I think that the condition 'if "commons" not in code' is not *always* a good solution.
Comment 1 Igor Remolar @ Betxí 2013-11-08 19:15:07 UTC
I assert that "" is the unique solution and it's right because the last function keep all links related with wikipedias, and doesn't expect a commons link.

getSite(code.replace('wiki','').replace('_', '-'), fam='wikipedia')

if "commons" appears in this function it raise a NoSuchSite error because  language family does not exist.

I have evaluate the following results: https://www.wikidata.org/w/api.php?action=query&format=jsonfm&prop=revisions&rvprop=content&titles=Q90&pllimit=max and I watch that commons link and wikivoyage links are included in the content. That means that it's necessary to exclude "commons" and "voyage" links to avoid other raise errors.

So I purpose the following change for the line 4719 of the file wikipedia.py:
links[code]['name']) for code in links if "commons" not in code and "voyage" not in code]
Comment 2 Igor Remolar @ Betxí 2013-11-08 19:22:02 UTC
I meant: I assert that "links[code]['name']) for code in links if "commons" not in code]"
Comment 3 xqt 2013-11-09 08:17:16 UTC
I made a dirty hack weeks ago in https://gerrit.wikimedia.org/r/#/c/85839/ as I found that problem. Maybe we should solve it in a generic way to filter the site in the interlanguage method but keep it for some interwiki links.

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


Navigation
Links