Package pywikipedia :: Module replace :: Class ReplacePageGenerator
[show private | hide private]
[frames | no frames]

Class ReplacePageGenerator


Generator which will yield Pages for pages that might contain text to
replace. These pages might be retrieved from a local SQL dump file or a
text file, or as a list of pages entered by the user.

Arguments:
    * source       - Where the bot should retrieve the page list from.
                     Can be 'sqldump', 'textfile', 'userinput' or 'allpages'.
    * replacements - A dictionary where keys are original texts and values
                     are replacement texts.
    * exceptions   - A list of strings; pages which contain one of these
                     won't be changed.
    * regex        - If the entries of replacements and exceptions should
                     be interpreted as regular expressions
    * namespace    - Namespace to process in case of a SQL dump. -1 means
                     that all namespaces should be searched.
    * textfilename - The textfile's path, either absolute or relative, which
                     will be used when source is 'textfile'.
    * sqlfilename  - The dump's path, either absolute or relative, which
                     will be used when source is 'sqldump'.
    * pagenames    - a list of pages which will be used when source is
                     'userinput'.

Method Summary
  __init__(self, source, replacements, exceptions, regex, namespace, textfilename, sqlfilename, categoryname, pagenames, startpage)
  generate(self)
Starts the generator.
  read_pages_from_category(self)
Generator which will yield pages that are listed in a text file created by the bot operator.
  read_pages_from_sql_dump(self)
Generator which will yield Pages to pages that might contain text to replace.
  read_pages_from_text_file(self)
Generator which will yield pages that are listed in a text file created by the bot operator.
  read_pages_from_wiki_page(self)
Generator which will yield pages that are listed in a wiki page.

Method Details

generate(self)

Starts the generator.

read_pages_from_category(self)

Generator which will yield pages that are listed in a text file created by
the bot operator. Will regard everything inside [[double brackets]] as a
page name, and yield Pages for these pages.

Arguments:
    * textfilename - the textfile's path, either absolute or relative

read_pages_from_sql_dump(self)

Generator which will yield Pages to pages that might contain text to
replace. These pages will be retrieved from a local sql dump file
(cur table).

Arguments:
    * sqlfilename  - the dump's path, either absolute or relative
    * replacements - a dictionary where old texts are keys and new texts
                     are values
    * exceptions   - a list of strings; pages which contain one of these
                     won't be changed.
    * regex        - if the entries of replacements and exceptions should
                     be interpreted as regular expressions

read_pages_from_text_file(self)

Generator which will yield pages that are listed in a text file created by
the bot operator. Will regard everything inside [[double brackets]] as a
page name, and yield Pages for these pages.

Arguments:
    * textfilename - the textfile's path, either absolute or relative

read_pages_from_wiki_page(self)

Generator which will yield pages that are listed in a wiki page. Will
regard everything inside [[double brackets]] as a page name, except for
interwiki and category links, and yield Pages for these pages.

Arguments:
    * pagetitle - the title of a page on the home wiki

Generated by Epydoc 2.1 on Sun Jul 03 17:07:34 2005 http://epydoc.sf.net