[Pywikipedia-l] SVN: [6293] trunk/pywikipedia/pagegenerators.py

russblau at svn.wikimedia.org russblau at svn.wikimedia.org
Mon Jan 26 14:48:24 UTC 2009


Revision: 6293
Author:   russblau
Date:     2009-01-26 14:48:24 +0000 (Mon, 26 Jan 2009)

Log Message:
-----------
Fix bug 2537742

Modified Paths:
--------------
    trunk/pywikipedia/pagegenerators.py

Modified: trunk/pywikipedia/pagegenerators.py
===================================================================
--- trunk/pywikipedia/pagegenerators.py	2009-01-24 22:23:16 UTC (rev 6292)
+++ trunk/pywikipedia/pagegenerators.py	2009-01-26 14:48:24 UTC (rev 6293)
@@ -865,7 +865,7 @@
         function returns true.  Otherwise, it returns false, so that caller
         can try parsing the argument. Call getCombinedGenerator() after all
         arguments have been parsed to get the final output generator.
-        
+
         """
         site = wikipedia.getSite()
         gen = None
@@ -1036,16 +1036,17 @@
 
 if __name__ == "__main__":
     try:
-        gen = None
         genFactory = GeneratorFactory()
         for arg in wikipedia.handleArgs():
-            generator = genFactory.handleArg(arg)
-            if generator:
-                gen = generator
-        if gen:
-            for page in gen:
-                wikipedia.output(page.title(), toStdout = True)
+            if not genFactory.handleArg(arg):
+                wikipedia.showHelp('pagegenerators')
+                break
         else:
-            wikipedia.showHelp('pagegenerators')
+            gen = genFactory.getCombinedGenerator()
+            if gen:
+                for page in gen:
+                    wikipedia.output(page.title(), toStdout = True)
+            else:
+                wikipedia.showHelp('pagegenerators')
     finally:
         wikipedia.stopme()





More information about the Pywikipedia-l mailing list