gws.base.web.action

Web action for pages, assets and files.

Source code: gws.base.web.action

Module Contents

class gws.base.web.action.AssetRequest(*args, **kwargs)

Bases: gws.Request

Asset request.

path: str

Asset path, relative to the assets directory.

class gws.base.web.action.AssetResponse(*args, **kwargs)

Bases: gws.Response

Asset response for API requests.

content: str

Asset content.

mimeType: str

Asset MIME type.

class gws.base.web.action.Config

Bases: gws.base.action.Config

Serves web pages, assets and files to the browser.

class gws.base.web.action.FileRequest(*args, **kwargs)

Bases: gws.Request

Request for a file stored in a feature field.

featureUid: str

Uid of the feature.

fieldName: str

Name of the file field.

modelUid: str

Uid of the model.

preview: bool = False

Return a preview instead of the file.

class gws.base.web.action.Object

Bases: gws.base.action.Object

Web action, serves pages, assets and files.

api_asset(req: gws.WebRequester, p: AssetRequest) → AssetResponse

Return an asset of the site or of the project.

download(req: gws.WebRequester, p) → gws.ContentResponse

Serve an asset as a download attachment.

file(req: gws.WebRequester, p: FileRequest) → gws.ContentResponse

Serve a file stored in a feature field.

get_page(req: gws.WebRequester, p: PageRequest) → gws.ContentResponse

Render the application home page or a project page.

http_asset(req: gws.WebRequester, p: AssetRequest) → gws.ContentResponse

Serve an asset of the site or of the project.

sys_asset(req: gws.WebRequester, p: AssetRequest) → gws.ContentResponse

Serve a client script or style sheet.

class gws.base.web.action.PageRequest(*args, **kwargs)

Bases: gws.Request

Page request.

name: str

Page name, home or project.

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.

user: gws.User

Current user.