module timelinelib.repositories.dbwrapper

class timelinelib.repositories.dbwrapper.DbWrapperCategoryRepository[source]

Bases: timelinelib.repositories.interface.CategoryRepository

__init__(db)[source]

Initialize self. See help(type(self)) for accurate signature.

get_all()[source]
get_tree(remove)[source]
save(category)[source]
class timelinelib.repositories.dbwrapper.DbWrapperEventRepository[source]

Bases: timelinelib.repositories.interface.EventRepository

__init__(db)[source]

Initialize self. See help(type(self)) for accurate signature.

save(event)[source]
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.