John Vandenberg has uploaded a new change for review.

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

Change subject: Deprecate APISite.checkBlocks
......................................................................

Deprecate APISite.checkBlocks

The 'checkBlocks' method is unused, and 'is blocked' is nearly always
wrong and should be replaced with permission checking using 'has_right'.

Also, use redirect_func to provide the already deprecated 'isBlocked'.

Change-Id: Iafc023d3bda1d1012d1d453ff2e990f34eebe333
---
M pywikibot/site.py
1 file changed, 13 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/19/180719/1

diff --git a/pywikibot/site.py b/pywikibot/site.py
index 8f82568..eb42d9e 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -1678,22 +1678,28 @@
     globaluserinfo = property(fget=getglobaluserinfo, doc=getuserinfo.__doc__)
 
     def is_blocked(self, sysop=False):
-        """Return true if and only if user is blocked.
+        """Return True when logged in user is blocked.
 
         @param sysop: If true, log in to sysop account (if available)
-
+        @type sysop: bool
+        @rtype: bool
         """
         if not self.logged_in(sysop):
             self.login(sysop)
         return 'blockinfo' in self._userinfo
 
-    @deprecated('is_blocked()')
-    def isBlocked(self, sysop=False):
-        """DEPRECATED."""
-        return self.is_blocked(sysop)
+    isBlocked = redirect_func(is_blocked, old_name='isBlocked',
+                              class_name='APISite')
 
+    @deprecated('has_right() or is_blocked()')
     def checkBlocks(self, sysop=False):
-        """Check if the user is blocked, and raise an exception if so."""
+        """
+        Raise an exception when the user is blocked. DEPRECATED.
+
+        @param sysop: If true, log in to sysop account (if available)
+        @type sysop: bool
+        @raises UserBlocked: The logged in user/sysop account is blocked.
+        """
         if self.is_blocked(sysop):
             # User blocked
             raise UserBlocked('User is blocked in site %s' % self)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iafc023d3bda1d1012d1d453ff2e990f34eebe333
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to