module timelinelib.repositories.dbwrapper¶
-
class
timelinelib.repositories.dbwrapper.
DbWrapperCategoryRepository
[source]¶ Bases:
timelinelib.repositories.interface.CategoryRepository
-
timelinelib.repositories.dbwrapper.
category_tree
(category_list, parent=None, remove=None)[source]¶ 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.