timApp.bookmark package
Contents
timApp.bookmark package#
Submodules#
timApp.bookmark.bookmarks module#
- class timApp.bookmark.bookmarks.BookmarkDictGroup[source]#
Bases:
TypedDict
- editable: bool#
- name: str#
- class timApp.bookmark.bookmarks.Bookmarks(user: timApp.user.user.User)[source]#
Bases:
object
Class for managing bookmarks.
Note
Bookmarks are stored as a JSON list in form
- [
- {
- “Bookmark group”[
{ “Link 1”: “https://example.com” }, { “Link 2”: “https://example.com” }
]
}, {
- “Bookmark group 2”[
{ “Link 1”: “https://example.com” }, { “Link 2”: “https://example.com” }
]
}
]
This class mainly allows to handle bookmars in a more convenient way.
- add_bookmark(groupname: str, name: str, link: str, move_to_top: bool = False, limit: Optional[int] = None) timApp.bookmark.bookmarks.Bookmarks [source]#
Adds a bookmark to the given bookmark group.
- Parameters
groupname – Group name to add.
name – Bookmark name.
link – Bookmark link.
move_to_top – If True, adds bookmark to the top of the group.
limit – If not None, limits the number of bookmarks in the group.
- Returns
This object.
- add_group(groupname: str) timApp.bookmark.bookmarks.Bookmarks [source]#
Adds a bookmark group.
- Parameters
groupname – Group name to add.
- Returns
This object.
- as_dict() list[timApp.bookmark.bookmarks.BookmarkDictGroup] [source]#
Returns the bookmark data as a list of dicts.
- Returns
A list of all bookmarks as dict objects.
- delete_bookmark(groupname: str, name: str) timApp.bookmark.bookmarks.Bookmarks [source]#
Deletes a bookmark from the given group.
- Parameters
groupname – Group name.
name – Bookmark name.
- Returns
This object.
- delete_group(groupname: str) timApp.bookmark.bookmarks.Bookmarks [source]#
Deletes a bookmark group.
- Parameters
groupname – Group name to delete.
- Returns
This object.
- get_bookmarks() list[dict[str, list[dict[str, str]]]] [source]#
Returns a collection of all bookmarks.
- Returns
Collection of all bookmarks.
timApp.bookmark.routes module#
- class timApp.bookmark.routes.BookmarkNoLink(group: str, name: str)[source]#
Bases:
object
- group: str#
- name: str#
- class timApp.bookmark.routes.BookmarkWithLink(group: str, name: str, link: str)[source]#
Bases:
timApp.bookmark.routes.BookmarkNoLink
- link: str#
- timApp.bookmark.routes.add_bookmark(m: timApp.bookmark.routes.BookmarkWithLink) flask.wrappers.Response [source]#
- timApp.bookmark.routes.add_course_bookmark(path: str, require_group: bool = False) flask.wrappers.Response [source]#
- timApp.bookmark.routes.add_to_course_bookmark(b: timApp.bookmark.bookmarks.Bookmarks, d: timApp.document.docinfo.DocInfo) None [source]#
- timApp.bookmark.routes.delete_bookmark(bm: timApp.bookmark.routes.BookmarkNoLink) flask.wrappers.Response [source]#
- timApp.bookmark.routes.edit_bookmark(old: timApp.bookmark.routes.BookmarkNoLink, new: timApp.bookmark.routes.BookmarkWithLink) flask.wrappers.Response [source]#
- timApp.bookmark.routes.get_bookmarks(user_id: int) flask.wrappers.Response [source]#
Gets user bookmark data for a specific user.