http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10444
Revision: 10444 Author: xqt Date: 2012-07-08 09:28:14 +0000 (Sun, 08 Jul 2012) Log Message: ----------- isRegistered() checks whether user is registered. This means there is still registrationTime() == -1.
Modified Paths: -------------- trunk/pywikipedia/userlib.py
Modified: trunk/pywikipedia/userlib.py =================================================================== --- trunk/pywikipedia/userlib.py 2012-07-08 07:21:39 UTC (rev 10443) +++ trunk/pywikipedia/userlib.py 2012-07-08 09:28:14 UTC (rev 10444) @@ -90,6 +90,18 @@ def username(self): return self._name
+ def isRegistered(self, force=False): + """ Return True if a user with this name is registered on this site, + False otherwise. + + @param force: if True, forces reloading the data from API + @type force: bool + """ + if self.isAnonymous(): + return False + else: + return self.registrationTime(force) != -1 + def isAnonymous(self): return ip_regexp.match(self.username) is not None
@@ -579,6 +591,8 @@ x = data[uj.name()] except KeyError: break + if 'missing' in x: + break uj._editcount = x['editcount'] if 'groups' in x: uj._groups = x['groups']
pywikipedia-svn@lists.wikimedia.org