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.

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!

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

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

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

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