Page MenuHomePhabricator

Implement basepage.stable_revision() in Pywikibot
Open, Needs TriagePublic

Description

Description

Add support for retrieving the stable (reviewed) revision of a page in Pywikibot via the FlaggedRevs extension.

On wikis with FlaggedRevs enabled (e.g., fiwiki, dewiki), the stable revision is the default version shown to readers — not necessarily the latest edit.
Currently, pages.latest_revision() returns the most recent revision, but bots and tools need access to the stable revision and its ID.

This task implements:

  • _basepage.stable_revision() → returns Revision object (like latest_revision())

Technical Approach

Add a new function stable_revision() to pywikibot/pages/_basepage.py to return the latest stable (reviewed) revision of the page.

Returns None if:

  • FlaggedRevs is not enabled on the site
  • No stable revision exists

Code Review Requirements:

For the patch to pass Pywikibot code review, please ensure:

Follow Gerrit guidelines:
   * Manual:Pywikibot/Gerrit - For_developers
   * Gerrit: Commit message guidelines
   * See also: T407059 (Pywikibot contribution how-to documentation)

Code quality:
Patch must follow the Pywikibot style guide
No flake8 errors or warnings

   * Commit message must follow style guidelines

Testing:

  • Added error handling must include unit tests
  • Tests should verify proper error detection and messaging for OAuth/BotPassword scenarios

Event Timeline

Change #1204707 had a related patch set uploaded (by Ezra yendau; author: Ezra yendau):

[pywikibot/core@master] Add BasePage.stable_revision() for FlaggedRevs stable revid

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