jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Expiry feature of Siteinfo ......................................................................
[FIX] Expiry feature of Siteinfo
The expiry needs to be converted into a timestamp also if the int is 0 (it thought it can the cache thing completely). Also one call used the old "force" parameter which was discontinued.
Change-Id: Ifc3406eab34e5cc5734c0659c9113cd277a23014 --- M pywikibot/site.py 1 file changed, 4 insertions(+), 4 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py index 96e5ee2..befcf3a 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -1080,10 +1080,10 @@ # expire = 0 (or timedelta(0)) are always expired and their bool is # False, so skip them EXCEPT if it's literally False, then they expire # never: "expiry is False" is different than "not expiry"! + # if it's a int convert to timedelta + if expiry is not False and isinstance(expiry, (int, float)): + expiry = datetime.timedelta(expiry) if expiry or expiry is False: - # if it's a int convert to timedelta - if expiry is not False and isinstance(expiry, (int, float)): - expiry = datetime.timedelta(expiry) try: cached = self._get_cached(key) except KeyError: @@ -1664,7 +1664,7 @@ """ if LV(self.version()) >= LV("1.16"): return pywikibot.Timestamp.fromISOformat( - self.siteinfo.get('time', force=True)) + self.siteinfo.get('time', expiry=0)) else: return pywikibot.Timestamp.fromtimestampformat( self.expand_text("{{CURRENTTIMESTAMP}}"))
pywikibot-commits@lists.wikimedia.org