Package pywikipedia :: Module wikipedia :: Class Page
[show private | hide private]
[frames | no frames]

Type Page

object --+
         |
        Page

Known Subclasses:
_Category

A page on the wiki.
Method Summary
  __init__(self, site, title, insite, tosite)
Constructor.
  __cmp__(self, other)
Pseudo method to be able to use equality and inequality tests on Page objects
  __hash__(self)
Pseudo method that makes it possible to store Page objects as keys in hash-tables.
  __repr__(self)
A more complete string representation
  __str__(self)
A console representation of the pagelink
  aslink(self, forceInterwiki)
A string representation in the form of a link.
  categories(self)
A list of categories that the article is in.
  catname(self, doublex)
The name of the page without the namespace part.
  contributingUsers(self)
Returns a set of all user names (including anonymous IPs) of those who edited the page.
  delete(pl, reason, prompt)
Deletes the page from the wiki.
  encoding(self)
Returns the character encoding used on this page's wiki.
  exists(self)
True if the page exists (itself or as redirect), False if not
  get(self, read_only, force, get_redirect, throttle)
The wiki-text of the page.
  getRedirectTarget(self, read_only)
If the page is a redirect page, gives the title of the page it redirects to.
  getReferences(self, follow_redirects)
Returns a list of pages that link to the page.
  getVersionHistory(self, forceReload)
Loads the version history page and returns a list of tuples, where each tuple represents one edit and is built of edit date/time, user name, and edit summary.
  imagelinks(self)
Gives the wiki-images the page shows, as a list of pagelink objects
  interwiki(self)
A list of interwiki links in the page.
  isCategory(self)
True if the page is a Category, false otherwise.
  isDisambig(self)
  isEmpty(self)
True if the page except for language links and category links has less than 4 characters, False otherwise.
  isImage(self)
True if the page is an Image description page, false otherwise.
  isRedirectPage(self)
True if the page is a redirect page, False if not or not existing
  linkedPages(self)
Gives the normal (not-interwiki, non-category) pages the page links to, as a list of Page objects
  linkname(self, doublex)
The name of the page this Page refers to, in a form suitable for a wiki-link
  namespace(self)
Gives the number of the namespace of the page.
  put(self, newtext, comment, watchArticle, minorEdit)
Replace the new page with the contents of the first argument.
  rawcategories(self)
Just like categories, but gives the categories including the part after the |, if any.
  section(self)
The name of the section this Page refers to.
  sectionFreeLinkname(self, doublex)
  site(self)
The site of the page this Page refers to, without :
  templates(self)
Gives a list of template names used on a page (strings).
  urlname(self)
The name of the page this Page refers to, in a form suitable for the URL of the page.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value

Method Details

__init__(self, site, title=None, insite=None, tosite=None)
(Constructor)

Constructor. Normally called with two arguments:
Parameters:
 1) The wikimedia site on which the page resides
 2) The title of the page as a unicode string
     
The argument insite can be specified to help decode
the name; it is the wikimedia site where this link was found.
Overrides:
__builtin__.object.__init__

__cmp__(self, other)
(Comparison operator)

Pseudo method to be able to use equality and inequality tests on Page objects

__hash__(self)
(Hashing function)

Pseudo method that makes it possible to store Page objects as keys in hash-tables. This relies on the fact that the string representation of an instance can not change after the construction.
Overrides:
__builtin__.object.__hash__

__repr__(self)
(Representation operator)

A more complete string representation
Overrides:
__builtin__.object.__repr__

__str__(self)
(Informal representation operator)

A console representation of the pagelink
Overrides:
__builtin__.object.__str__

aslink(self, forceInterwiki=False)

A string representation in the form of a link. The link will be an interwiki link if needed.

If you set forceInterwiki to True, the link will have the format of an interwiki link even if it points to the home wiki.

Note that the family is never included.

categories(self)

A list of categories that the article is in. This will retrieve the page text to do its work, so it can raise the same exceptions that are raised by the get() method.

The return value is a list of Page objects for each of the category links in the page text.

catname(self, doublex=False)

The name of the page without the namespace part. Gives an error if the page is from the main namespace. Note that this is a raw way of doing things - it simply looks for a : in the name.

contributingUsers(self)

Returns a set of all user names (including anonymous IPs) of those who edited the page.

delete(pl, reason=None, prompt=True)

Deletes the page from the wiki. Requires administrator status. If reason is None, asks for a reason. If prompt is True, asks the user if he wants to delete the page.

encoding(self)

Returns the character encoding used on this page's wiki.

exists(self)

True if the page exists (itself or as redirect), False if not

get(self, read_only=False, force=False, get_redirect=False, throttle=True)

The wiki-text of the page. This will retrieve the page if it has not
been retrieved yet. This can raise the following exceptions that
should be caught by the calling code:

 NoPage: The page does not exist

 IsRedirectPage: The page is a redirect. The argument of the
                 exception is the page it redirects to.

 LockedPage: The page is locked, and therefore it won't be possible
             to change the page. This exception won't be raised
             if the argument read_only is True.

 SectionError: The subject does not exist on a page with a # link

getRedirectTarget(self, read_only=False)

If the page is a redirect page, gives the title of the page it redirects to. Otherwise it will raise an IsNotRedirectPage exception.

This function can raise a NoPage exception, and unless the argument read_only is True, a LockedPage exception as well.

getReferences(self, follow_redirects=True)

Returns a list of pages that link to the page. If follow_redirects is True, also returns pages that link to a redirect pointing to the page.

getVersionHistory(self, forceReload=False)

Loads the version history page and returns a list of tuples, where each tuple represents one edit and is built of edit date/time, user name, and edit summary.

imagelinks(self)

Gives the wiki-images the page shows, as a list of pagelink objects

interwiki(self)

A list of interwiki links in the page. This will retrieve the page text to do its work, so it can raise the same exceptions that are raised by the get() method.

The return value is a list of Page objects for each of the interwiki links in the page text.

isCategory(self)

True if the page is a Category, false otherwise.

isEmpty(self)

True if the page except for language links and category links has less than 4 characters, False otherwise. Can return the same exceptions as get()

isImage(self)

True if the page is an Image description page, false otherwise.

isRedirectPage(self)

True if the page is a redirect page, False if not or not existing

linkedPages(self)

Gives the normal (not-interwiki, non-category) pages the page links to, as a list of Page objects

linkname(self, doublex=False)

The name of the page this Page refers to, in a form suitable for a wiki-link

namespace(self)

Gives the number of the namespace of the page. Does not work for all namespaces in all languages, only when defined in family.py. If not defined, it will return 0 (the main namespace)

put(self, newtext, comment=None, watchArticle=None, minorEdit=True)

Replace the new page with the contents of the first argument. The second argument is a string that is to be used as the summary for the modification

If watchArticle is None, leaves the watchlist status unchanged.

rawcategories(self)

Just like categories, but gives the categories including the part after the |, if any. Of course these will thus be pagelinks to non-existing pages, but as long as we just use linkname() and such, that won't matter.

section(self)

The name of the section this Page refers to. Sections are denominated by a # in the linkname(). If no section is referenced, None is returned.

site(self)

The site of the page this Page refers to, without :

templates(self)

Gives a list of template names used on a page (strings).

urlname(self)

The name of the page this Page refers to, in a form suitable for the URL of the page.

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