agency.app

Classes

AgencyApp

Baseclass for Morepath OneGov applications.

Functions

get_create_new_organisation_factory(...)

get_template_directory(→ str)

get_template_variables(→ onegov.core.types.RenderData)

get_theme(→ onegov.agency.theme.AgencyTheme)

get_usergroup_form_class(...)

get_i18n_localedirs(→ list[str])

get_ticket_manager_roles(→ tuple[str, Ellipsis])

get_disabled_extensions(→ tuple[str, Ellipsis])

get_webasset_output(→ str)

get_js_path(→ str)

get_people_select_asset(→ Iterator[str])

get_sortable_multi_checkbox_asset(→ Iterator[str])

get_redactor_asserts(→ Iterator[str])

get_editor_assets(→ Iterator[str])

get_api_endpoints(→ list[type[ApiEndpoint[Any]]])

Module Contents

class agency.app.AgencyApp[source]

Bases: onegov.org.OrgApp, onegov.api.ApiApp

Baseclass for Morepath OneGov applications.

request_class[source]

The class of the Request to create. Must be a subclass of morepath.Request.

By default the request class is morepath.Request

property filestorage: fs.base.SubFS[fs.base.FS][source]

Returns a filestorage object bound to the current application. Based on this nifty module:

https://docs.pyfilesystem.org/en/latest/

The file storage returned is guaranteed to be independent of other applications (the scope is the application_id, not just the class).

There is no guarantee as to what file storage backend is actually used. It’s quite possible that the file storage will be somewhere online in the future (e.g. S3).

Therefore, the urls for the file storage should always be acquired through onegov.core.request.CoreRequest.filestorage_link().

The backend is configured through configure_application().

For a list of methods available on the resulting object, consult this list: https://docs.pyfilesystem.org/en/latest/interface.html.

If no filestorage is available, this returns None. See self.has_filestorage.

WARNING: Files stored in the filestorage are available publicly! All someone has to do is to guess the filename. To get an unguessable filename use onegov.core.filestorage.random_filename().

The reason for this is the fact that filestorage may be something external in the future.

This should not deter you from using this for user uploads, though you should be careful. If you want to be sure that your application stores files locally, use some other ways of storing those files.

Example:

from onegov.core import filestorage

filename = filestorage.random_filename()
app.filestorage.writetext(filename, 'Lorem Ipsum')

# returns either an url like '/files/4ec56cc005c594880a...'
# or maybe 'https://amazonaws.com/onegov-cloud/32746/220592/q...'
request.filestorage_link(filename)
property root_pdf_exists: bool[source]
property people_xlsx_exists: bool[source]
property root_pdf_modified: datetime | None[source]
property people_xlsx_modified: datetime | None[source]
property root_pdf: bytes | None[source]
property people_xlsx: bytes | None[source]
property pdf_class: type[onegov.agency.pdf.AgencyPdfDefault][source]
property enable_yubikey: bool[source]
agency.app.get_create_new_organisation_factory() Callable[[AgencyApp, str], Organisation][source]
agency.app.get_template_directory() str[source]
agency.app.get_template_variables(request: onegov.agency.request.AgencyRequest) onegov.core.types.RenderData[source]
agency.app.get_theme() onegov.agency.theme.AgencyTheme[source]
agency.app.get_usergroup_form_class() type[onegov.agency.forms.UserGroupForm][source]
agency.app.get_i18n_localedirs() list[str][source]
agency.app.get_ticket_manager_roles() tuple[str, Ellipsis][source]
agency.app.get_disabled_extensions() tuple[str, Ellipsis][source]
agency.app.get_webasset_output() str[source]
agency.app.get_js_path() str[source]
agency.app.get_people_select_asset() Iterator[str][source]
agency.app.get_sortable_multi_checkbox_asset() Iterator[str][source]
agency.app.get_redactor_asserts() Iterator[str][source]
agency.app.get_editor_assets() Iterator[str][source]
agency.app.get_api_endpoints() list[type[ApiEndpoint[Any]]][source]