timApp.note package#

Submodules#

timApp.note.notes module#

class timApp.note.notes.UserNoteAndUser(user, note, editable, private)[source]#

Bases: NamedTuple

editable: bool#

Alias for field number 2

note: timApp.note.usernote.UserNote#

Alias for field number 1

private: bool#

Alias for field number 3

user: timApp.user.user.User#

Alias for field number 0

timApp.note.notes.get_notes(usergroup_id: int, doc: timApp.document.document.Document, include_public=True) list[tuple[timApp.note.usernote.UserNote, timApp.user.user.User]][source]#

Gets all notes for a document a particular user has access to.

Parameters
  • usergroup_id – The usergroup id.

  • doc – The document for which to get the notes.

timApp.note.notes.move_notes(src_par: timApp.document.docparagraph.DocParagraph, dest_par: timApp.document.docparagraph.DocParagraph)[source]#

Moves all notes from one paragraph to another. :param src_par: Source paragraph :param dest_par: Destination paragraph

timApp.note.notes.process_notes(result: list[tuple[timApp.note.usernote.UserNote, timApp.user.user.User]]) list[tuple[timApp.note.usernote.UserNote, timApp.user.user.User]][source]#
timApp.note.notes.strtotags(tagstr: str) list[str][source]#
timApp.note.notes.tagstostr(tags: list[str]) str[source]#

timApp.note.routes module#

class timApp.note.routes.DeletedNote(notification: timApp.notification.pending_notification.PendingNotification)[source]#

Bases: object

property access: str#
notification: timApp.notification.pending_notification.PendingNotification#
to_json() dict[str, Any][source]#
class timApp.note.routes.ParContext(curr: timApp.document.editing.globalparid.GlobalParId, orig: timApp.document.editing.globalparid.GlobalParId)[source]#

Bases: object

This roughly corresponds to the ParContext TypeScript class.

curr: timApp.document.editing.globalparid.GlobalParId#
has_diff_orig() bool[source]#
orig: timApp.document.editing.globalparid.GlobalParId#
timApp.note.routes.check_note_access_ok(is_public: bool, doc: timApp.document.document.Document) None[source]#
timApp.note.routes.check_note_ctx_match(n: timApp.note.usernote.UserNote, p: timApp.document.docparagraph.DocParagraph) None[source]#
timApp.note.routes.check_permissions_and_get_orig(ctx: timApp.note.routes.ParContext, is_public: bool) tuple[timApp.document.docinfo.DocInfo, timApp.document.docparagraph.DocParagraph][source]#
timApp.note.routes.clear_doc_cache_after_comment(docinfo: timApp.document.docinfo.DocInfo, user: timApp.user.user.User, is_public: bool) None[source]#
timApp.note.routes.comment_response(ctx: timApp.note.routes.ParContext, orig_docinfo: timApp.document.docinfo.DocInfo, p: timApp.document.docparagraph.DocParagraph) flask.wrappers.Response[source]#
timApp.note.routes.delete_note(id: int, ctx: timApp.note.routes.ParContext) flask.wrappers.Response[source]#
timApp.note.routes.edit_note(id: int, ctx: timApp.note.routes.ParContext, text: str, access: str, tags: dict[str, bool] | None = None) flask.wrappers.Response[source]#
timApp.note.routes.get_comment_and_check_exists(note_id: int) timApp.note.usernote.UserNote[source]#
timApp.note.routes.get_note(note_id: int) flask.wrappers.Response[source]#
timApp.note.routes.get_notes(item_path: str, private: bool = False, deleted: bool = False, start: datetime.datetime | None = None, end: datetime.datetime | None = None) flask.wrappers.Response[source]#

Gets all notes in a document or folder.

Parameters
  • item_path – Path of the item.

  • private – Whether private comments should be included; only usable for admins

  • deleted – Whether deleted public comments should be included

  • start – Start timestamp of notes.

  • end – End timestamp of notes.

timApp.note.routes.has_note_edit_access(n: timApp.note.usernote.UserNote) bool[source]#
timApp.note.routes.post_note(text: str, access: str, ctx: timApp.note.routes.ParContext, tags: dict[str, bool] | None = None) flask.wrappers.Response[source]#

timApp.note.usernote module#

class timApp.note.usernote.UserNote(**kwargs)[source]#

Bases: sqlalchemy.ext.declarative.api.Model

A comment/note that has been posted in a document paragraph.

access#

Who can see this comment. So far valid values are ‘everyone’ and ‘justme’.

block#
content#

Comment content.

created#

Comment creation timestamp.

doc_id#

The document id in which this comment was posted.

html#

Comment HTML cache.

id#

Comment id.

property is_public: bool#
modified#

Comment modification timestamp.

par_hash#

The paragraph hash at the time this comment was posted.

par_id#

The paragraph id in which this comment was posted.

tags#

Tags for the comment.

to_json()[source]#
usergroup#
usergroup_id#

The UserGroup id who posted the comment.

timApp.note.usernote.get_comment_by_id(c_id: int) timApp.note.usernote.UserNote | None[source]#

Module contents#