Package pywikipedia :: Module category :: Class CategoryTreeRobot
[show private | hide private]
[frames | no frames]

Class CategoryTreeRobot


Robot to create tree overviews of the category structure.

Parameters:
    * catTitle - The category which will be the tree's root.
    * catDB    - A CategoryDatabase object
    * maxDepth - The limit beyond which no subcategories will be listed.
                 This also guarantees that loops in the category structure
                 won't be a problem.
    * filename - The textfile where the tree should be saved; None to print
                 the tree to stdout.

Method Summary
  __init__(self, catTitle, catDB, filename, maxDepth)
  run(self)
Prints the multi-line string generated by treeview or saves it to a file.
  treeview(self, cat, currentDepth, parent)
Returns a multi-line string which contains a tree view of all subcategories of cat, up to level maxDepth.

Method Details

run(self)

Prints the multi-line string generated by treeview or saves it to a file.

Parameters:
    * catTitle - the title of the category which will be the tree's root
    * maxDepth - the limit beyond which no subcategories will be listed

treeview(self, cat, currentDepth=0, parent=None)

Returns a multi-line string which contains a tree view of all subcategories
of cat, up to level maxDepth. Recursively calls itself.

Parameters:
    * cat - the Category of the node we're currently opening
    * currentDepth - the current level in the tree (for recursion)
    * parent - the Category of the category we're coming from

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