gws.base.web.action
¶
Handle dynamic assets.
An asset is a file located in a global or project-specific assets
directory.
In order to access a project asset, the user must have read
permission for the project itself.
When the Web application receives a webAsset
request with a path
argument, it first checks the project-specific assets directory,
and then the global dir.
If the file is found, and its name matches gws.base.template.manager.TEMPLATE_TYPES
, a respective Template
object is generated on the fly and rendered.
The renderer is passed a TemplateArgs
object as an argument.
The gws.Response
object returned from rendering is passed back to the user.
If the file is not a template and matches the allowMime/denyMime
filter, its content is returned to the user.
Source code: gws.base.web.action
Module Contents¶
- class gws.base.web.action.AssetRequest(*args, **kwargs)¶
Bases:
gws.Request
Command request.
- path: str¶
- class gws.base.web.action.AssetResponse(*args, **kwargs)¶
Bases:
gws.Request
Command request.
- content: str¶
- mime: str¶
- class gws.base.web.action.Config¶
Bases:
gws.base.action.Config
- class gws.base.web.action.FileRequest(*args, **kwargs)¶
Bases:
gws.Request
Command request.
- featureUid: str¶
- fieldName: str¶
- modelUid: str¶
- preview: bool = False¶
- class gws.base.web.action.Object¶
Bases:
gws.base.action.Object
Web action
- api_asset(req: gws.WebRequester, p: AssetRequest) AssetResponse ¶
Return an asset under the given path and project
- download(req: gws.WebRequester, p) gws.ContentResponse ¶
- file(req: gws.WebRequester, p: FileRequest) gws.ContentResponse ¶
- http_asset(req: gws.WebRequester, p: AssetRequest) gws.ContentResponse ¶
- sys_asset(req: gws.WebRequester, p: AssetRequest) gws.ContentResponse ¶
- class gws.base.web.action.Props¶
Bases:
gws.base.action.Props
- class gws.base.web.action.TemplateArgs(*args, **kwargs)¶
Bases:
gws.TemplateArgs
Asset template arguments.
- locale: gws.Locale¶
Locale object.
- params: dict¶
Request parameters.
- project: gws.Project | None¶
Current project.
- projects: list[gws.Project]¶
List of user projects.
- req: gws.WebRequester¶
Requester object.