Huji submitted this change.

View Change

Approvals: Huji: Looks good to me, approved jenkins-bot: Verified
[bugfix] detect range blocks with Page.is_blocked()

Bug: T301282
Change-Id: I135d7bc492bc5347041aaab8edeb830b6b5b0d8f
---
M pywikibot/page/__init__.py
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 3c5aca7..afe7df4 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -2919,7 +2919,7 @@
if not hasattr(self, '_userprops'):
self._userprops = list(self.site.users([self.username, ]))[0]
if self.isAnonymous():
- r = list(self.site.blocks(users=self.username))
+ r = list(self.site.blocks(iprange=self.username, total=1))
if r:
self._userprops['blockedby'] = r[0]['by']
self._userprops['blockreason'] = r[0]['reason']
@@ -2954,7 +2954,8 @@
"""Determine whether the user is currently blocked.

.. versionchanged:: 7.0
- renamed from :meth:`isBlocked` method
+ renamed from :meth:`isBlocked` method,
+ can also detect range blocks.

:param force: if True, forces reloading the data from API
"""

To view, visit change 761111. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I135d7bc492bc5347041aaab8edeb830b6b5b0d8f
Gerrit-Change-Number: 761111
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Huji <huji.huji@gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged