http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10147
Revision: 10147 Author: xqt Date: 2012-04-21 04:30:25 +0000 (Sat, 21 Apr 2012) Log Message: ----------- re-arrange doc; left margin on pagegenerators' indent; update from trunk r10146
Modified Paths: -------------- branches/rewrite/scripts/category.py
Modified: branches/rewrite/scripts/category.py =================================================================== --- branches/rewrite/scripts/category.py 2012-04-21 04:29:45 UTC (rev 10146) +++ branches/rewrite/scripts/category.py 2012-04-21 04:30:25 UTC (rev 10147) @@ -6,54 +6,55 @@ Syntax: python category.py action [-option]
where action can be one of these: - * add - mass-add a category to a list of pages - * remove - remove category tag from all pages in a category - * move - move all pages in a category to another category - * tidy - tidy up a category by moving its articles into subcategories - * tree - show a tree of subcategories of a given category - * listify - make a list of all of the articles that are in a category + * add - mass-add a category to a list of pages + * remove - remove category tag from all pages in a category + * move - move all pages in a category to another category + * tidy - tidy up a category by moving its articles into subcategories + * tree - show a tree of subcategories of a given category + * listify - make a list of all of the articles that are in a category
and option can be one of these:
Options for "add" action: - * -person - sort persons by their last name - * -create - If a page doesn't exist, do not skip it, create it instead + * -person - sort persons by their last name + * -create - If a page doesn't exist, do not skip it, create it instead
If action is "add", the following options are supported:
¶ms;
Options for "listify" action: - * -overwrite - This overwrites the current page with the list even if - something is already there. - * -showimages - This displays images rather than linking them in the list. - * -talkpages - This outputs the links to talk pages of the pages to be - listified in addition to the pages themselves. + * -overwrite - This overwrites the current page with the list even if + something is already there. + * -showimages - This displays images rather than linking them in the list. + * -talkpages - This outputs the links to talk pages of the pages to be + listified in addition to the pages themselves.
Options for "remove" action: - * -nodelsum - This specifies not to use the custom edit summary as the - deletion reason. Instead, it uses the default deletion reason - for the language, which is "Category was disbanded" in English. + * -nodelsum - This specifies not to use the custom edit summary as the + deletion reason. Instead, it uses the default deletion reason + for the language, which is "Category was disbanded" in + English.
Options for several actions: - * -rebuild - reset the database - * -from: - The category to move from (for the move option) - Also, the category to remove from in the remove option - Also, the category to make a list of in the listify option - * -to: - The category to move to (for the move option) - - Also, the name of the list to make in the listify option + * -rebuild - reset the database + * -from: - The category to move from (for the move option) + Also, the category to remove from in the remove option + Also, the category to make a list of in the listify option + * -to: - The category to move to (for the move option) + - Also, the name of the list to make in the listify option NOTE: If the category names have spaces in them you may need to use a special syntax in your shell so that the names aren't treated as separate parameters. For instance, in BASH, use single quotes, e.g. -from:'Polar bears' - * -batch - Don't prompt to delete emptied categories (do it - automatically). - * -summary: - Pick a custom edit summary for the bot. - * -inplace - Use this flag to change categories in place rather than - rearranging them. - * -recurse - Recurse through all subcategories of categories. - * -match - Only work on pages whose titles match the given regex (for - move and remove actions). + * -batch - Don't prompt to delete emptied categories (do it + automatically). + * -summary: - Pick a custom edit summary for the bot. + * -inplace - Use this flag to change categories in place rather than + rearranging them. + * -recurse - Recurse through all subcategories of categories. + * -match - Only work on pages whose titles match the given regex (for + move and remove actions).
For the actions tidy and tree, the bot will store the category structure locally in category.dump. This saves time and server load, but if it uses @@ -81,6 +82,7 @@ # (C) leogregianin, 2004-2008 # (C) Cyde, 2006-2010 # (C) Anreas J Schwab, 2007 +# (C) xqt, 2009-2012 # (C) Pywikipedia team, 2008-2012 # __version__ = '$Id$'