Page MenuHomePhabricator

Defined approach to clear all local state from BasePage objects
Closed, ResolvedPublic

Description

BasePage and subclasses use private attributes to store cached values.

Currently there is no defined manner to clear all local state in a BasePage object, or that of subclasses.

Historically the usual approach as been to delete the Page object & create a new one if necessary. That works OK for bots which typically throw away Page objects immediately after use, but isnt a feasible approach when the library needs to clear the cached values of a object.

There is a property deleter for latest_revision_id and text, which doesnt clear a few of the saved local state variables, but not all.

Event Timeline

jayvdb raised the priority of this task from to Needs Triage.
jayvdb updated the task description. (Show Details)
jayvdb added a project: Pywikibot.
jayvdb subscribed.

Change 271980 had a related patch set uploaded (by Dalba):
site.py: Delete cached page attributes after deleting the page

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

Change 271980 merged by jenkins-bot:
page.py: Create a new function to clear cached page attributes

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