Page MenuHomePhabricator

Provide a generic data record which can be subclassed by Revision
Closed, ResolvedPublicFeature

Description

Feature summary
Provide a generic data record which can be accessed by key or by attribute.

Use case(s):
The [[file:///C:/pwb/GIT/core/docs/_build/html/api_ref/pywikibot.page.html#page._revision.Revision|Revision]] class is such a Mapping. It holds data retrieved from the API, transforms selected values to higher-level objects, and provides access either by attribute or by item key.

Benefits:
Other Mappings can be provided, e.g. for user contributions, log entries, event streams, and other API data. An upcast function should be available to transform API data into higher-level classes such as Page or Timestamp.

Revision cannot be reused by other API methods because its upcast method is specific to revisions and also takes into account that formatversion=1 is used.

Event Timeline

Xqt triaged this task as Medium priority.

Change #1311863 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] IMPR: Add a new collection class DataRecord an derive Revision from it

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

Change #1311863 merged by jenkins-bot:

[pywikibot/core@master] IMPR: Add a new collection class DataRecord an derive Revision from it

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