jenkins-bot has submitted this change and it was merged.
Change subject: use try finally as usual ......................................................................
use try finally as usual
Change-Id: I49a78e164e6e31bec4d6872d1217c2286c0eb845 --- M pagegenerators.py 1 file changed, 17 insertions(+), 19 deletions(-)
Approvals: Ladsgroup: Looks good to me, approved jenkins-bot: Verified
diff --git a/pagegenerators.py b/pagegenerators.py index 3908343..4b57567 100644 --- a/pagegenerators.py +++ b/pagegenerators.py @@ -14,7 +14,7 @@ ¶ms; """ # -# (C) Pywikipedia bot team, 2005-2013 +# (C) Pywikibot team, 2005-2014 # # Distributed under the terms of the MIT license. # @@ -1320,25 +1320,23 @@
def main(*args): - try: - genFactory = GeneratorFactory() - for arg in pywikibot.handleArgs(*args): - if not genFactory.handleArg(arg): - pywikibot.showHelp() - break + genFactory = GeneratorFactory() + for arg in pywikibot.handleArgs(*args): + if not genFactory.handleArg(arg): + pywikibot.showHelp() + break + else: + gen = genFactory.getCombinedGenerator() + if gen: + for i, page in enumerate(gen, start=1): + pywikibot.output("%4d: %s" % (i, page.title()), + toStdout=True) else: - gen = genFactory.getCombinedGenerator() - if gen: - i = 0 - for page in gen: - i += 1 - pywikibot.output("%4d: %s" % (i, page.title()), - toStdout=True) - else: - pywikibot.showHelp() - finally: - pywikibot.stopme() + pywikibot.showHelp()
if __name__ == "__main__": - main() + try: + main() + finally: + pywikibot.stopme()
pywikibot-commits@lists.wikimedia.org