http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9555
Revision: 9555
Author: xqt
Date: 2011-09-25 18:48:53 +0000 (Sun, 25 Sep 2011)
Log Message:
-----------
use pagegenerators -namespace option
Modified Paths:
--------------
trunk/pywikipedia/template.py
Modified: trunk/pywikipedia/template.py
===================================================================
--- trunk/pywikipedia/template.py 2011-09-25 18:41:52 UTC (rev 9554)
+++ trunk/pywikipedia/template.py 2011-09-25 18:48:53 UTC (rev 9555)
@@ -22,9 +22,6 @@
info will be loaded from the maintenance page of the live wiki.
argument can also be given as "-xml:filename.xml".
--namespace: Only process templates in the given namespace number (may be used
- multiple times).
-
-user: Only process pages edited by a given user
-skipuser: Only process pages not edited by a given user
@@ -66,7 +63,9 @@
python template.py test -subst -namespace:2 -namespace:3
+Note that -namespace: is a global pywikipedia parameter
+
This next example substitutes the template lived with a supplied edit summary.
It only performs substitutions in main article namespace and doesn't prompt to
start replacing. Note that -putthrottle: is a global pywikipedia parameter.
@@ -296,11 +295,6 @@
u'Please enter the XML dump\'s filename: ')
else:
xmlfilename = arg[5:]
- elif arg.startswith('-namespace:'):
- try:
- namespaces.append(int(arg[len('-namespace:'):]))
- except ValueError:
- namespaces.append(arg[len('-namespace:'):])
elif arg.startswith('-category:'):
addedCat = arg[len('-category:'):]
elif arg.startswith('-summary:'):
@@ -347,8 +341,6 @@
gen = pagegenerators.CombinedPageGenerator(gens)
gen = pagegenerators.DuplicateFilterPageGenerator(gen)
- if namespaces:
- gen = pagegenerators.NamespaceFilterPageGenerator(gen, namespaces)
if user:
gen = UserEditFilterGenerator(gen, user, timestamp, skip)
preloadingGen = pagegenerators.PreloadingGenerator(gen)