:tocdepth: 3 :py:mod:`gws.base.web.action` ============================= .. py:module:: gws.base.web.action .. autoapi-nested-parse:: 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 :obj:`gws.base.template.manager.TEMPLATE_TYPES`, a respective ``Template`` object is generated on the fly and rendered. The renderer is passed a :obj:`TemplateArgs` object as an argument. The :obj:`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:** :source:`gws.base.web.action` Module Contents --------------- .. py:class:: AssetRequest(*args, **kwargs) Bases: :py:obj:`gws.Request` Command request. .. py:attribute:: path :type: str .. py:class:: AssetResponse(*args, **kwargs) Bases: :py:obj:`gws.Request` Command request. .. py:attribute:: content :type: str .. py:attribute:: mime :type: str .. py:class:: Config Bases: :py:obj:`gws.base.action.Config` Web action configuration. .. py:class:: FileRequest(*args, **kwargs) Bases: :py:obj:`gws.Request` Command request. .. py:attribute:: featureUid :type: str .. py:attribute:: fieldName :type: str .. py:attribute:: modelUid :type: str .. py:attribute:: preview :type: bool :value: False .. py:class:: Object Bases: :py:obj:`gws.base.action.Object` Web action .. py:method:: api_asset(req: gws.WebRequester, p: AssetRequest) -> AssetResponse Return an asset under the given path and project .. py:method:: download(req: gws.WebRequester, p) -> gws.ContentResponse .. py:method:: file(req: gws.WebRequester, p: FileRequest) -> gws.ContentResponse .. py:method:: http_asset(req: gws.WebRequester, p: AssetRequest) -> gws.ContentResponse .. py:method:: sys_asset(req: gws.WebRequester, p: AssetRequest) -> gws.ContentResponse .. py:class:: Props Bases: :py:obj:`gws.base.action.Props` .. py:class:: TemplateArgs(*args, **kwargs) Bases: :py:obj:`gws.TemplateArgs` Asset template arguments. .. py:attribute:: locale :type: gws.Locale Locale object. .. py:attribute:: params :type: dict Request parameters. .. py:attribute:: project :type: Optional[gws.Project] Current project. .. py:attribute:: projects :type: list[gws.Project] List of user projects. .. py:attribute:: req :type: gws.WebRequester Requester object. .. py:attribute:: user :type: gws.User Current user.