http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10677
Revision: 10677 Author: xqt Date: 2012-11-08 10:59:53 +0000 (Thu, 08 Nov 2012) Log Message: ----------- -maxlag is item of config; use the new part. use getattr/setattr
Modified Paths: -------------- branches/rewrite/pywikibot/bot.py
Modified: branches/rewrite/pywikibot/bot.py =================================================================== --- branches/rewrite/pywikibot/bot.py 2012-11-08 10:46:33 UTC (rev 10676) +++ branches/rewrite/pywikibot/bot.py 2012-11-08 10:59:53 UTC (rev 10677) @@ -420,8 +420,6 @@ config.put_throttle = int(arg[len("-putthrottle:") : ]) elif arg.startswith('-pt:'): config.put_throttle = int(arg[len("-pt:") : ]) - elif arg.startswith("-maxlag:"): - config.maxlag = int(arg[len("-maxlag:") : ]) elif arg == '-log': if moduleName not in config.log: config.log.append(moduleName) @@ -485,9 +483,8 @@ 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]) + type(getattr(config, cmd[0]) == int: + setattr(config, cmd[0], cmd[1]) # the argument is not global. Let the specific bot script care # about it. else: