http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10676
Revision: 10676 Author: xqt Date: 2012-11-08 10:46:33 +0000 (Thu, 08 Nov 2012) Log Message: ----------- enable global options depending numerical config settings: -API_config_expiry -verbose_output -interwiki_min_subjects -minthrottle -maxthrottle -put_throttle -maxlag -special_page_limit -max_external_links -copyright_max_query_for_page -copyright_skip_query -copyright_connection_tries -copyright_exceeded_in_queries -copyright_exceeded_in_queries_sleep_hours -socket_timeout -max_queue_size
Modified Paths: -------------- branches/rewrite/pywikibot/bot.py
Modified: branches/rewrite/pywikibot/bot.py =================================================================== --- branches/rewrite/pywikibot/bot.py 2012-11-08 09:24:26 UTC (rev 10675) +++ branches/rewrite/pywikibot/bot.py 2012-11-08 10:46:33 UTC (rev 10676) @@ -479,9 +479,19 @@ import daemonize daemonize.daemonize(redirect_std = arg[11:]) else: + # the argument depends numerical config settings + cmd = [] + if ':' in arg: + cmd = arg[1:].split(':') + if len(cmd) == 2 and len(cmd[1]) > 0 and \ + hasattr(config, cmd[0]) and \ + type(config.__dict__[cmd[0]]) == int: + print 'global', arg, cmd[0], cmd[1] + config.__dict__[cmd[0]] = int(cmd[1]) # the argument is not global. Let the specific bot script care # about it. - nonGlobalArgs.append(arg) + else: + nonGlobalArgs.append(arg)
if username: config.usernames[config.family][config.mylang] = username
pywikipedia-svn@lists.wikimedia.org