Revision: 4450 Author: leogregianin Date: 2007-10-16 10:39:49 +0000 (Tue, 16 Oct 2007)
Log Message: ----------- Patch 1813093: -start and -namespace
Modified Paths: -------------- trunk/pywikipedia/fixing_redirects.py
Modified: trunk/pywikipedia/fixing_redirects.py =================================================================== --- trunk/pywikipedia/fixing_redirects.py 2007-10-16 09:53:55 UTC (rev 4449) +++ trunk/pywikipedia/fixing_redirects.py 2007-10-16 10:39:49 UTC (rev 4450) @@ -131,11 +131,18 @@ try: gen = None action = None + start = '!' + namspace2 = 0 mysite = wikipedia.getSite() linktrail = mysite.linktrail()
for arg in wikipedia.handleArgs(): - if arg == '-featured': + if arg.startswith('-start'): + if len(arg) == 6: + start = wikipedia.input(u'Which start where?') + else: + start = arg[7:] + elif arg == '-featured': action = True featured = wikipedia.translate(mysite, featured_articles) ref = wikipedia.Page(wikipedia.getSite(), featured) @@ -151,6 +158,15 @@ title = arg[6:] page = wikipedia.Page(wikipedia.getSite(), title) workon(page) + elif arg.startswith('-namespace'): + action = True + if len(arg) == 10: + namespace2 = int(wikipedia.input(u'Which namespace should be processed?')) + else: + namespace2 =int( arg[11:]) + for page in pagegenerators.AllpagesPageGenerator(start =start, namespace = namespace2, includeredirects = False): + workon(page) +
if not action: wikipedia.showHelp('fixing_redirects')