Page MenuHomePhabricator

newitem.py doesn't handle the case where interwiki links are present in the page content
Open, NormalPublic

Description

https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/scripts/newitem.py

	        if page.langlinks():
	            # FIXME: Implement this
	            pywikibot.output(
	                "Found language links (interwiki links).\n"
	                "Haven't implemented that yet so skipping.")
	            return

This piece of code has been here for (almost) four years but never properly fixed.

Details

Related Gerrit Patches:

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptJul 18 2018, 10:14 AM

interwikidata.py is the alternative for this.

Could you please tell me the approach how can we retrieve language links (interwiki links) from a page?

It's in the code snippet: page.langlinks().

Change 446620 had a related patch set uploaded (by AdityaJ; owner: AdityaJ):
[pywikibot/core@master] fix interwiki links issue in newitem.py

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

Change 446622 had a related patch set uploaded (by AdityaJ; owner: AdityaJ):
[pywikibot/core@master] fix interwiki links issue in newitem.py

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

Could you please tell me the approach how can we retrieve language links (interwiki links) from a page?

Hello @AdityaJ, thanks for your change. However, I don't see how printing these interwiki links to the console can be useful ? Can you specify it ?
Also, note that you've created two patchs, please mark one of these as "abandoned" on gerrit interface. You can amend your commit to make a change next time :)

Framawiki added a comment.EditedJul 18 2018, 5:52 PM

As I understand currently newitem.py skips pages that have one or more interwiki links in its wikitext.

Can someone edit the description to explain what is the needed implementation ? Something like creating the item and add both current page and her language pages as links to the new item, or add link to the current page if an item is already listed to an interwiki page ?

Framawiki renamed this task from fix interwiki links issue in newitem.py to newitem.py doesn't handle the case where interwiki links are present in the page content.Jul 18 2018, 5:53 PM

Change 446620 abandoned by AdityaJ:
fix interwiki links issue in newitem.py

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

What if we use 'setSitelinks' function for the newly generated Item?

It can fail because some those links can already be attached to different items.

@Bugreporter I have implemented a solution. Can you review my patch?

D3r1ck01 moved this task from Backlog to Needs Review on the Pywikibot board.Dec 22 2018, 6:17 PM
Xqt triaged this task as Normal priority.Dec 25 2018, 5:03 PM

Change 446622 abandoned by AdityaJ:
fix interwiki links issue in newitem.py

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

Xqt moved this task from Needs Review to Backlog on the Pywikibot board.Feb 3 2019, 11:42 AM