Page MenuHomePhabricator

expiry parameter of Site.siteinfo.get() is weird
Closed, ResolvedPublicBUG REPORT

Description

Site.siteinfo.get() parameter expiry may be either an int of float or boolean type.

If expiry is an int or float, the Siteinfo.get() method checks whether the cache is expired for that given days (a float value enables factional days). An expiry of 0 or 0.0 means that expiry is always True and Siteinfo is loaded from API instead from cache. If expiry is False Siteinfo is always loaded from cache. But curiously if If expiry is True the result is the same as for False: Siteinfo is always loaded from cache.

current behavior:

site.siteinfo.get('general', expiry=True) loads siteinfo from cache

expected behaviour:

site.siteinfo.get('general', expiry=True) loads siteinfo from API

Event Timeline

Xqt triaged this task as Medium priority.Aug 16 2020, 9:34 AM
Xqt changed the subtype of this task from "Task" to "Bug Report".

Change 620504 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] load siteinfo from API if expiry=Truy in Siteinfo.get() method

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

Change 620504 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] load siteinfo from API if expiry=True in Siteinfo.get() method

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