Page MenuHomePhabricator

refactor sitelinks structure to support badges
Closed, ResolvedPublic

Description

When badges will be actually supported by the WikibaseRepo extension (T42810, Wikidata:Development plan#Badges), we may have to rework the whole structure of ItemPage.sitelinks, either:

  • using tuples as (Page, (ItemPage, ItemPage, ))

or:

  • creating a new Sitelink class, with ItemPage.iterlinks() iterating over a list of Sitelink instances, Sitelink.page returning a Page object, and Sitelink.badges containing a list of ItemPage instances;

The latter scheme would probably increase maintainability in the long term.

Of course, we will also add functions to edit badges via the API.

Details

Reference
bz64457
Related Gerrit Patches:
pywikibot/core : masterImplement badges for sitelinks
pywikibot/core : masterRefactor Link

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:23 AM
bzimport set Reference to bz64457.

Even better: the Sitelink class should inherit from Page and then set the .badges property.

Change 131019 had a related patch set uploaded by Ricordisamoa:
[POC] [BREAKING] refactor the sitelinks structure

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

Badges are now used on the 'production' Wikidata!

jayvdb moved this task from Backlog to Framework on the Pywikibot-Wikidata board.Nov 30 2014, 12:12 PM

Change 131019 abandoned by Ricordisamoa:
[POC] [BREAKING] refactor the sitelinks structure

Reason:
Should be done properly in pywikibot/wikibase

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

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 23 2015, 6:36 AM
Ricordisamoa removed Ricordisamoa as the assignee of this task.Sep 23 2015, 6:37 AM
Ricordisamoa removed a project: Patch-For-Review.
Ricordisamoa set Security to None.

Change 442168 had a related patch set uploaded (by Lokal Profil; owner: Lokal Profil):
[pywikibot/core@master] [WIP] Refactor Link

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

Change 442169 had a related patch set uploaded (by Lokal Profil; owner: Lokal Profil):
[pywikibot/core@master] [WIP] Implement badges for sitelinks

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

Change 442168 had a related patch set uploaded (by Lokal Profil; owner: Lokal Profil):
[pywikibot/core@master] [WIP] Refactor Link

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

I picked this up again in https://gerrit.wikimedia.org/r/442168 and https://gerrit.wikimedia.org/r/442169
The first re-factors Link to introduce BaseLink the second is basically @Ricordisamoa's patch but now extending BaseLink instead of Page.

New tests etc. are still missing and I'll have to hunt for instance of Link which need to become instance of BaseLink but feedback on whether this is at all a sane re-factor are welcome before that.
ping: @valhallasw @jayvdb since you looked at the original patch

matej_suchanek updated the task description. (Show Details)
Xqt moved this task from Backlog to Needs Review on the Pywikibot board.Feb 3 2019, 11:25 AM
Xqt assigned this task to Lokal_Profil.Feb 7 2019, 4:21 PM

I finally took the time to re-base the re-factor of Link (gerrit:442168). Will try to do the same for the follow up patch-set (gerrit:442169) tomorrow evening.

Change 442168 merged by jenkins-bot:
[pywikibot/core@master] Refactor Link

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

Lokal_Profil closed this task as Resolved.May 20 2019, 3:56 PM

Merged and @TODOs were nuked in a later commit

Change 442169 merged by jenkins-bot:
[pywikibot/core@master] Implement badges for sitelinks

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