http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10449
Revision: 10449 Author: xqt Date: 2012-07-09 09:48:21 +0000 (Mon, 09 Jul 2012) Log Message: ----------- move handleArgs into main(), bugfix for bug #3406565 (ImportError in tag_nowcommons.py) already hidden since r9553
Modified Paths: -------------- trunk/pywikipedia/nowcommons.py
Modified: trunk/pywikipedia/nowcommons.py =================================================================== --- trunk/pywikipedia/nowcommons.py 2012-07-09 09:43:08 UTC (rev 10448) +++ trunk/pywikipedia/nowcommons.py 2012-07-09 09:48:21 UTC (rev 10449) @@ -48,7 +48,7 @@ # # (C) Wikipedian, 2006-2007 # (C) Siebrand Mazeland, 2007-2008 -# (C) xqt,2010-2011 +# (C) xqt,2010-2012 # (C) Pywikipedia bot team, 2006-2011 # # Distributed under the terms of the MIT license. @@ -63,28 +63,6 @@ # only for nowCommonsMessage from imagetransfer import nowCommonsMessage
-autonomous = False -replace = False -replacealways = False -replaceloose = False -replaceonly = False -use_hash = False - -for arg in pywikibot.handleArgs(): - if arg == '-autonomous': - autonomous = True - if arg == '-replace': - replace = True - if arg == '-replacealways': - replace = True - replacealways = True - if arg == '-replaceloose': - replaceloose = True - if arg == '-replaceonly': - replaceonly = True - if arg == '-hash': - use_hash = True - nowCommons = { '_default': [ u'NowCommons' @@ -435,6 +413,30 @@
def main(): + global autonomous + global replace, replacealways, replaceloose, replaceonly + global use_hash + autonomous = False + replace = False + replacealways = False + replaceloose = False + replaceonly = False + use_hash = False + + for arg in pywikibot.handleArgs(): + if arg == '-autonomous': + autonomous = True + if arg == '-replace': + replace = True + if arg == '-replacealways': + replace = True + replacealways = True + if arg == '-replaceloose': + replaceloose = True + if arg == '-replaceonly': + replaceonly = True + if arg == '-hash': + use_hash = True bot = NowCommonsDeleteBot() bot.run()
pywikipedia-svn@lists.wikimedia.org