timApp.bookmark package#

Submodules#

timApp.bookmark.bookmarks module#

class timApp.bookmark.bookmarks.BookmarkDictEntry[source]#

Bases: TypedDict

name: str#
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.

has_bookmark(groupname: str, name: str) bool[source]#

Checks if a bookmark with the given name exists in the given group.

Parameters
  • groupname – Group name.

  • name – Bookmark name.

Returns

True if the bookmark exists, False otherwise.

save_bookmarks() None[source]#

Saves edited bookmarks to the database.

timApp.bookmark.routes module#

Bases: object

group: str#
name: str#

Bases: timApp.bookmark.routes.BookmarkNoLink

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.create_bookmark_group(groupname: str) flask.wrappers.Response[source]#
timApp.bookmark.routes.delete_bookmark(bm: timApp.bookmark.routes.BookmarkNoLink) flask.wrappers.Response[source]#
timApp.bookmark.routes.delete_bookmark_group(group: str) 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.

timApp.bookmark.routes.get_bookmarks_current() flask.wrappers.Response[source]#

Gets user bookmark data for the currently logged-in user.

timApp.bookmark.routes.mark_last_read(doc_id: int, view: str) flask.wrappers.Response[source]#

Module contents#