timApp.folder package
Contents
timApp.folder package#
Submodules#
timApp.folder.createopts module#
timApp.folder.folder module#
- class timApp.folder.folder.Folder(**kwargs)[source]#
Bases:
sqlalchemy.ext.declarative.api.Model
,timApp.item.item.Item
Represents a folder in the directory hierarchy.
- property block: timApp.item.block.Block | None#
Overridden for optimization: root folder does not have a db entry, so we won’t try to query for it.
- static create(path: str, owner_groups: Optional[Union[list[timApp.user.usergroup.UserGroup], timApp.user.usergroup.UserGroup]] = None, title=None, creation_opts: timApp.folder.createopts.FolderCreationOptions = FolderCreationOptions(apply_default_rights=False, get_templates_rights_from_parent=True)) timApp.folder.folder.Folder [source]#
Creates a new folder with the specified name. If the folder already exists, it is returned.
- Parameters
title – The folder title.
creation_opts – Additional folder creation options.
path – The name of the folder to be created.
owner_groups – The owner group.
- Returns
The created or existing folder.
- static find_by_location(location, name) timApp.folder.folder.Folder | None [source]#
- static find_by_path(path, fallback_to_id=False) timApp.folder.folder.Folder | None [source]#
- static find_first_existing(path: str) timApp.folder.folder.Folder | None [source]#
Finds the first existing folder for the given path.
For example, if the folders
a a/b
exist, then:
if path is a/b/c, returns a/b if path is a/b, returns a if path is a, returns the root folder if path is empty, returns None
- get_all_documents(relative_paths: list[str] = None, include_subdirs: bool = False, custom_filter: Any = None, query_options: Any = None, filter_user: User | None = None) list[DocInfo] [source]#
- get_all_folders() list[timApp.folder.folder.Folder] [source]#
- static get_all_in_path(root_path: str = '', filter_ids: Optional[Iterable[int]] = None, recurse=False) list[timApp.folder.folder.Folder] [source]#
Gets all the folders under a path.
- Parameters
recurse – Whether to search recursively.
root_path – Restricts the search to a specific folder.
filter_ids – An optional iterable of document ids for filtering the folders. Must be non-empty if supplied.
- Returns
A list of Folder objects.
- static get_by_id(fid) timApp.folder.folder.Folder | None [source]#
- get_document(relative_path: str, create_if_not_exist=False, creator_group=None) None | timApp.document.docentry.DocEntry [source]#
- static get_root() timApp.folder.folder.Folder [source]#
- id#
Folder identifier.
- property is_empty#
- location#
Folder location (first parts of the path).
- name#
Folder name (last part of path).
- property parent: timApp.folder.folder.Folder | None#
- property path#
Returns the Document path, including the language part in case of a translation.
- property path_without_lang#
Returns path without the language part.
For folders, this is the same as the path itself.
- relative_path(item: timApp.item.item.Item) str [source]#