jenkins-bot has submitted this change and it was merged.
Change subject: [FEAT] category: Apply namespace to tidy action ......................................................................
[FEAT] category: Apply namespace to tidy action
The tidy action of the category script could apply the selected namespaces.
Bug: T86351 Change-Id: I134ef38dcc1b6a010624ebe8039c339157de4ea0 --- M scripts/category.py 1 file changed, 9 insertions(+), 3 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/category.py b/scripts/category.py index 8a9d8cf..0c1a3c4 100755 --- a/scripts/category.py +++ b/scripts/category.py @@ -48,6 +48,12 @@ target page (and talk page, if -allowsplit is not set) doesn't exist.
+Options for "tidy" action: + * -namespaces Filter the arcitles in the specified namespaces. Separate + -namespace multiple namespace numbers or names with commas. Examples: + -ns -ns:0,2,4 + -ns:Help,MediaWiki + Options for several actions: * -rebuild - reset the database * -from: - The category to move from (for the move option) @@ -807,7 +813,7 @@
"""
- def __init__(self, catTitle, catDB): + def __init__(self, catTitle, catDB, namespaces=None): """Constructor.""" self.catTitle = catTitle self.catDB = catDB @@ -818,7 +824,7 @@ self.cat = pywikibot.Category(site, catTitle) super(CategoryTidyRobot, self).__init__( generator=pagegenerators.PreloadingGenerator( - self.cat.articles())) + self.cat.articles(namespaces=namespaces)))
def move_to_category(self, article, original_cat, current_cat): """ @@ -1203,7 +1209,7 @@ move_together=move_together) elif action == 'tidy': catTitle = pywikibot.input(u'Which category do you want to tidy up?') - bot = CategoryTidyRobot(catTitle, catDB) + bot = CategoryTidyRobot(catTitle, catDB, genFactory.namespaces) elif action == 'tree': catTitle = pywikibot.input( u'For which category do you want to create a tree view?')
pywikibot-commits@lists.wikimedia.org