Revision: 8219 Author: nicdumz Date: 2010-05-26 10:17:53 +0000 (Wed, 26 May 2010)
Log Message: ----------- avoid UnboundLocalError exceptions: define site before arg handling
Modified Paths: -------------- trunk/pywikipedia/blockpageschecker.py
Modified: trunk/pywikipedia/blockpageschecker.py =================================================================== --- trunk/pywikipedia/blockpageschecker.py 2010-05-26 10:07:32 UTC (rev 8218) +++ trunk/pywikipedia/blockpageschecker.py 2010-05-26 10:17:53 UTC (rev 8219) @@ -211,6 +211,9 @@ moveBlockCheck = False; genFactory = pagegenerators.GeneratorFactory() # To prevent Infinite loops errorCount = 0 + + site = pywikibot.getSite() + # Loading the default options. for arg in pywikibot.handleArgs(): if arg == '-always': @@ -232,9 +235,9 @@ type = 'move') elif arg.startswith('-page'): if len(arg) == 5: - generator = [pywikibot.Page(pywikibot.getSite(), pywikibot.input(u'What page do you want to use?'))] + generator = [pywikibot.Page(site, pywikibot.input(u'What page do you want to use?'))] else: - generator = [pywikibot.Page(pywikibot.getSite(), arg[6:])] + generator = [pywikibot.Page(site, arg[6:])] else: genFactory.handleArg(arg)
@@ -242,8 +245,6 @@ pywikibot.output(u"Your project is not supported by this script.\nYou have to edit the script and add it!") return
- # Load the right site - site = pywikibot.getSite()
# Take the right templates to use, the category and the comment TSP = pywikibot.translate(site, templateSemiProtection)