[Pywikipedia-svn] SVN: [7318] trunk/pywikipedia/welcome.py

alexsh at svn.wikimedia.org alexsh at svn.wikimedia.org
Fri Sep 25 16:07:41 UTC 2009


Revision: 7318
Author:   alexsh
Date:     2009-09-25 16:07:41 +0000 (Fri, 25 Sep 2009)

Log Message:
-----------
combine blocked() into parseLog() for userlib.isBlocked()

Modified Paths:
--------------
    trunk/pywikipedia/welcome.py

Modified: trunk/pywikipedia/welcome.py
===================================================================
--- trunk/pywikipedia/welcome.py	2009-09-25 15:28:23 UTC (rev 7317)
+++ trunk/pywikipedia/welcome.py	2009-09-25 16:07:41 UTC (rev 7318)
@@ -517,7 +517,7 @@
         if contribnum >= number:
             wikipedia.output(u'%s has enough edits to be welcomed' % username.name() )
             # The user must be welcomed, return his data.
-            yield ([username.name(), contribnum])
+            yield ([username.name(), contribnum, username.isBlocked()])
         elif contribnum < number:
             if contribnum == 0:
                 wikipedia.output(u'%s has no contributions.' % username.name() )
@@ -555,21 +555,6 @@
         pos = y.end()
         wikipedia.output(u'%s is already in the report page.' % username)
 
-def blocked(username):
-    #action=query&list=users&ususers=Filnik&usprop=blockinfo
-    """
-    Function that detects if a user is currently blocked or not.
-    """  
-    params = {
-        'action': 'query',
-        'list': 'users',
-        'ususers': username,
-        'usprop': 'blockinfo',
-    }
-
-    # If there's not the blockedby parameter (that means the user isn't blocked), it will return False otherwise True.
-    return query.GetData(params, encodeTitle = False)['query']['users'][0].has_key('blockedby')
-
 def defineSign(wsite, signPageTitle, fileSignName = None, fileOption = False):
     """ Function to load the random signatures. """
     reg = r"^\* ?(.*?)$"
@@ -895,8 +880,8 @@
                 # OK, no problem
                 pass
             # Check if the user has been already blocked.
-            ki = blocked(username)
-            if ki == True:
+            
+            if found_result[2] == True:
                 wikipedia.output(u'%s has been blocked! Skipping...' % usertalkpage.titleWithoutNamespace())
                 continue
             # Understand if the user has a bad-username.





More information about the Pywikipedia-svn mailing list