Package Gnumed :: Package timelinelib :: Package repositories :: Module dbwrapper
[frames] | no frames]

Module dbwrapper

source code

Classes
  DbWrapperCategoryRepository
  DbWrapperEventRepository
Functions
 
category_tree(category_list, parent=None, remove=None)
Transform flat list of categories to a tree based on parent attribute.
source code

Imports: CategoryRepository, EventRepository, sort_categories


Function Details

category_tree(category_list, parent=None, remove=None)

source code 

Transform flat list of categories to a tree based on parent attribute.

The top-level categories have the given parent and each level in the tree is sorted.

If remove is given then the subtree with remove as root will not be included.

The tree is represented as a list of tuples, (cat, sub-tree), where cat is the parent category and subtree is the same tree representation of the children.