gws.base.web.site

Source code: gws.base.web.site

Module Contents

class gws.base.web.site.CorsConfig(*args, **kwargs)

Bases: gws.Config

Object configuration.

allowCredentials: bool = False

Access-Control-Allow-Credentials header.

allowHeaders: str = ''

Access-Control-Allow-Headers header.

allowMethods: str = ''

Access-Control-Allow-Methods header.

allowOrigin: str = ''

Access-Control-Allow-Origin header.

maxAge: int = 5

Access-Control-Max-Age header.

class gws.base.web.site.RewriteRuleConfig(*args, **kwargs)

Bases: gws.Config

Object configuration.

pattern: gws.Regex

expression to match the url against

target: str

target url with placeholders

options: dict | None

additional options

reversed: bool = False

reversed rewrite rule

class gws.base.web.site.SSLConfig(*args, **kwargs)

Bases: gws.Config

SSL configuration

crt: gws.FilePath

crt bundle location

key: gws.FilePath

key file location

class gws.base.web.site.WebDocumentRootConfig(*args, **kwargs)

Bases: gws.Config

Base directory for assets

dir: gws.DirPath

directory path

allowMime: list[str] | None

allowed mime types

denyMime: list[str] | None

disallowed mime types (from the standard list)

class gws.base.web.site.Config(*args, **kwargs)

Bases: gws.Config

Site (virtual host) configuration

assets: WebDocumentRootConfig | None

assets location and options

cors: CorsConfig | None

cors configuration

errorPage: gws.ext.config.template | None

error page template

host: str = '*'

host name

rewrite: list[RewriteRuleConfig] | None

rewrite rules

canonicalHost: str = ''

hostname for reversed rewriting

root: WebDocumentRootConfig

document root location and options

class gws.base.web.site.Object

Bases: gws.WebSite

Web site.

canonicalHost: str
ssl: bool
configure()

Configuration hook.

url_for(req, path, **params)

Rewrite a request path to an Url.

Parameters:
  • req – Web Requester.

  • path – Raw request path.

  • **kwargs – Extra GET params.

Returns:

A rewritten URL.