http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10448
Revision: 10448
Author: xqt
Date: 2012-07-09 09:43:08 +0000 (Mon, 09 Jul 2012)
Log Message:
-----------
show logfile name in -help;
shorten Site.recentchanges() def line to 80 chars.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2012-07-09 08:20:19 UTC (rev 10447)
+++ trunk/pywikipedia/wikipedia.py 2012-07-09 09:43:08 UTC (rev 10448)
@@ -6790,7 +6790,10 @@
yield o, t, u, c
return
- def recentchanges(self, number = 100, rcstart = None, rcend = None, rcshow = None, rcdir='older', rctype ='edit|new', namespace=None, includeredirects=True, repeat = False, user = None, returndict = False):
+ def recentchanges(self, number=100, rcstart=None, rcend=None, rcshow=None,
+ rcdir='older', rctype='edit|new', namespace=None,
+ includeredirects=True, repeat=False, user=None,
+ returndict=False):
"""
Yield recent changes as Page objects
uses API call: action=query&list=recentchanges&rctype=edit|new&rclimit=500
@@ -8186,8 +8189,9 @@
-help Show this help text.
--log Enable the logfile. Logs will be stored in the logs
- subdirectory.
+-log Enable the logfile, using the default filename
+ "%s.log"
+ Logs will be stored in the logs subdirectory.
-log:xyz Enable the logfile, using 'xyz' as the filename.
@@ -8211,7 +8215,7 @@
(-dry) debugging of new code (if given, doesn't do any real
changes, but only shows what would have been changed).
DEPRECATED: please use -simulate instead of -dry
-'''# % moduleName
+''' % moduleName
output(globalHelp, toStdout=True)
try:
exec('import %s as module' % moduleName)
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']