http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10261
Revision: 10261
Author: xqt
Date: 2012-05-31 15:45:34 +0000 (Thu, 31 May 2012)
Log Message:
-----------
update -user -maxlag options from rewrite r6171, r6280, r10260
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2012-05-31 15:40:41 UTC (rev 10260)
+++ trunk/pywikipedia/wikipedia.py 2012-05-31 15:45:34 UTC (rev 10261)
@@ -7761,6 +7761,7 @@
# the module name will be used for the filename of the log.
moduleName = calledModuleName()
nonGlobalArgs = []
+ username = None
do_help = False
for arg in args:
arg = _decodeArg(arg)
@@ -7772,12 +7773,16 @@
default_family = arg[8:]
elif arg.startswith('-lang:'):
default_code = arg[6:]
+ elif arg.startswith("-user:"):
+ username = arg[len("-user:") : ]
elif arg.startswith('-putthrottle:'):
config.put_throttle = int(arg[len("-putthrottle:") : ])
put_throttle.setDelay()
elif arg.startswith('-pt:'):
config.put_throttle = int(arg[len("-pt:") : ])
put_throttle.setDelay()
+ elif arg.startswith("-maxlag:"):
+ config.maxlag = int(arg[len("-maxlag:") : ])
elif arg == '-log':
setLogfileStatus(True)
elif arg.startswith('-log:'):
@@ -7809,6 +7814,9 @@
# about it.
nonGlobalArgs.append(arg)
+ if username:
+ config.usernames[config.family][config.mylang] = username
+
# TEST for bug #3081100
if unicode_error:
output("""
@@ -7851,6 +7859,8 @@
wikipedia, wiktionary, wikitravel, ...
This will override the configuration in user-config.py.
+-user:xyz Log in as user 'xyz' instead of the default username.
+
-daemonize:xyz Immediately return control to the terminal and redirect
stdout and stderr to xyz (only use for bots that require
no input from stdin).
@@ -7862,6 +7872,10 @@
-log:xyz Enable the logfile, using 'xyz' as the filename.
+-maxlag Sets a new maxlag parameter to a number of seconds. Defer bot
+ edits during periods of database server lag. Default is set by
+ config.py
+
-nolog Disable the logfile (if it is enabled by default).
-putthrottle:n Set the minimum time (in seconds) the bot will wait between