Merlijn van Deen has submitted this change and it was merged.

Change subject: [FIX] Siteinfo: Correctly compare cache time
......................................................................


[FIX] Siteinfo: Correctly compare cache time

The expiry check worked backwards and didn't actually check if the
cached time was in the past (adding the expiry).

Bug: T94293
Change-Id: I7e43b0191b945c76dd19e30a560431bea928e4a0
---
M pywikibot/site.py
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Merlijn van Deen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/site.py b/pywikibot/site.py
index 457a917..1b1bef0 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -1226,7 +1226,8 @@
         elif not cache_date:  # default values are always expired
             return True
         else:
-            return cache_date + expire >= datetime.datetime.utcnow()
+            # cached date + expiry are in the past if it's expired
+            return cache_date + expire < datetime.datetime.utcnow()
 
     def _get_general(self, key, expiry):
         """

-- 
To view, visit https://gerrit.wikimedia.org/r/200300
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7e43b0191b945c76dd19e30a560431bea928e4a0
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <commodorefabia...@gmx.de>
Gerrit-Reviewer: John Vandenberg <jay...@gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhall...@arctus.nl>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to