org.views.files =============== .. py:module:: org.views.files .. autoapi-nested-parse:: The onegov org collection of files uploaded to the site. Attributes ---------- .. autoapisummary:: org.views.files.FileT Classes ------- .. autoapisummary:: org.views.files.Img Functions --------- .. autoapisummary:: org.views.files.get_thumbnail_size org.views.files.view_get_file_collection org.views.files.view_file_details org.views.files.view_file_links org.views.files.handle_publish org.views.files.handle_unpublish org.views.files.toggle_publication org.views.files.handle_update_publish_date org.views.files.handle_update_start_date org.views.files.handle_update_end_date org.views.files.view_get_image_collection org.views.files.view_get_file_collection_json org.views.files.view_get_image_collection_json org.views.files.handle_file_upload org.views.files.view_upload_file org.views.files.view_upload_general_file org.views.files.view_upload_image_file org.views.files.view_upload_file_by_json org.views.files.view_file_digest org.views.files.handle_sign org.views.files.view_old_files_redirect org.views.files.assert_has_mtan_access org.views.files.view_directory_file org.views.files.view_directory_thumbnail org.views.files.view_directory_file_head org.views.files.view_directory_thumbnail_head Module Contents --------------- .. py:data:: FileT .. py:function:: get_thumbnail_size(image: onegov.org.models.ImageFile) -> tuple[str, str] .. py:class:: Img(src: str, alt: str | None = None, title: str | None = None, url: str | None = None, extra: str | None = None, width: str | None = None, height: str | None = None) Represents an img element. .. py:attribute:: __slots__ :value: ('src', 'alt', 'title', 'url', 'extra', 'width', 'height') .. py:attribute:: src .. py:attribute:: alt :value: None .. py:attribute:: title :value: None .. py:attribute:: url :value: None .. py:attribute:: width :value: None .. py:attribute:: height :value: None .. py:attribute:: extra :value: None .. py:method:: from_image(layout: onegov.org.layout.DefaultLayout, image: onegov.org.models.ImageFile) -> Self :classmethod: .. py:function:: view_get_file_collection(self: onegov.org.models.GeneralFileCollection, request: onegov.org.request.OrgRequest, layout: onegov.org.layout.DefaultLayout | None = None) -> onegov.core.types.RenderData .. py:function:: view_file_details(self: onegov.org.models.GeneralFile, request: onegov.org.request.OrgRequest, layout: onegov.org.layout.DefaultLayout | None = None) -> str .. py:function:: view_file_links(self: onegov.org.models.GeneralFile, request: onegov.org.request.OrgRequest, layout: onegov.org.layout.DefaultLayout | None = None) -> str .. py:function:: handle_publish(self: onegov.org.models.GeneralFile, request: onegov.org.request.OrgRequest) -> None .. py:function:: handle_unpublish(self: onegov.org.models.GeneralFile, request: onegov.org.request.OrgRequest) -> None .. py:function:: toggle_publication(self: onegov.org.models.GeneralFile, request: onegov.org.request.OrgRequest) -> None .. py:function:: handle_update_publish_date(self: onegov.org.models.GeneralFile, request: onegov.org.request.OrgRequest) -> None .. py:function:: handle_update_start_date(layout: onegov.org.layout.DefaultLayout, request: onegov.org.request.OrgRequest, self: onegov.org.models.GeneralFile) -> None .. py:function:: handle_update_end_date(layout: onegov.org.layout.DefaultLayout, request: onegov.org.request.OrgRequest, self: onegov.org.models.GeneralFile) -> None .. py:function:: view_get_image_collection(self: onegov.org.models.file.BaseImageFileCollection[Any], request: onegov.org.request.OrgRequest, layout: onegov.org.layout.DefaultLayout | None = None) -> onegov.core.types.RenderData .. py:function:: view_get_file_collection_json(self: onegov.org.models.GeneralFileCollection, request: onegov.org.request.OrgRequest) -> onegov.core.types.JSON_ro .. py:function:: view_get_image_collection_json(self: onegov.org.models.file.BaseImageFileCollection[Any], request: onegov.org.request.OrgRequest, produce_image: collections.abc.Callable[[onegov.org.models.ImageFile], Any] | None = None) -> list[dict[str, Any]] .. py:function:: handle_file_upload(self: onegov.file.FileCollection[FileT], request: onegov.org.request.OrgRequest) -> FileT Stores the file given with the request and returns the new file object. .. py:function:: view_upload_file(self: onegov.file.FileCollection[FileT], request: onegov.org.request.OrgRequest, return_file: Literal[True]) -> FileT view_upload_file(self: onegov.file.FileCollection[FileT], request: onegov.org.request.OrgRequest, return_file: Literal[False] = False) -> webob.Response .. py:function:: view_upload_general_file(self: onegov.org.models.GeneralFileCollection, request: onegov.org.request.OrgRequest, layout: onegov.org.layout.DefaultLayout | None = None) -> str .. py:function:: view_upload_image_file(self: onegov.org.models.ImageFileCollection, request: onegov.org.request.OrgRequest, layout: onegov.org.layout.DefaultLayout | None = None) -> str .. py:function:: view_upload_file_by_json(self: onegov.file.FileCollection[Any], request: onegov.org.request.OrgRequest) -> onegov.core.types.JSON_ro .. py:function:: view_file_digest(self: onegov.org.models.GeneralFileCollection, request: onegov.org.request.OrgRequest, layout: onegov.org.layout.DefaultLayout | None = None) -> str .. py:function:: handle_sign(self: onegov.file.File, request: onegov.org.request.OrgRequest, layout: onegov.org.layout.DefaultLayout | None = None) -> str .. py:function:: view_old_files_redirect(self: onegov.org.models.LegacyFile | onegov.org.models.LegacyImage, request: onegov.org.request.OrgRequest) -> webob.Response | str Redirects to the migrated depot file if possible. As a result, old image urls are preserved and will continue to function. .. py:function:: assert_has_mtan_access(self: onegov.directory.models.directory.DirectoryFile, request: onegov.org.request.OrgRequest) -> None .. py:function:: view_directory_file(self: onegov.directory.models.directory.DirectoryFile, request: onegov.org.request.OrgRequest) -> depot.io.interfaces.StoredFile .. py:function:: view_directory_thumbnail(self: onegov.directory.models.directory.DirectoryFile, request: onegov.org.request.OrgRequest) -> depot.io.interfaces.StoredFile | webob.Response .. py:function:: view_directory_file_head(self: onegov.directory.models.directory.DirectoryFile, request: onegov.org.request.OrgRequest) -> depot.io.interfaces.StoredFile .. py:function:: view_directory_thumbnail_head(self: onegov.directory.models.directory.DirectoryFile, request: onegov.org.request.OrgRequest) -> depot.io.interfaces.StoredFile | webob.Response