kerno.web.pyramid.typing module

Pyramid typing stubs so we can write annotated views.

class kerno.web.pyramid.typing.KRequest[source]

Bases: kerno.web.pyramid.typing.PyramidRequest

Typing stub for a Pyramid/kerno request object.

It is recommended that you subclass with a more specific typing annotation for the user instance variable.

add_flash(**kw) kerno.state.UIMessage[source]

Add a flash message to the current Pyramid session.

kerno: kerno.kerno.Kerno
repo: kerno.repository.sqlalchemy.BaseSQLAlchemyRepository
user: Any
class kerno.web.pyramid.typing.MultiDictStub[source]

Bases: dict

Typing stub for webob.multidict.MultiDict.

getall(key: str) List[Union[Dict[str, Any], List[Any], str, int, float]][source]

Return a list of all values matching key (may be an empty list).

getone(key: str) Union[Dict[str, Any], List[Any], str, int, float][source]

Get one value matching the key. May raise KeyError.

class kerno.web.pyramid.typing.PyramidRequest[source]

Bases: object

Typing stub for pure Pyramid request objects.

GET: kerno.web.pyramid.typing.MultiDictStub
POST: kerno.web.pyramid.typing.MultiDictStub
accept_language: Any
body: bytes
client_addr: str
context: Any
cookies: Dict[str, Any]
exception: Optional[Exception]
identity: Any
json_body: Union[Dict[str, Any], List[Any], str, int, float]
matchdict: Dict[str, Any]
method: str
params: kerno.web.pyramid.typing.MultiDictStub
path: str
path_info: str
path_qs: str
path_url: str
registry: kerno.web.pyramid.typing.RegistryStub
response: kerno.web.pyramid.typing.PyramidResponse
route_path(route_name: str, *elements, **kw) str[source]

Generate a relative URL for a named Pyramid route.

session: kerno.web.pyramid.typing.PyramidSession
static_path(path: str, **kw) str[source]

Generate a relative URL to a static resource.

url: str
class kerno.web.pyramid.typing.PyramidResponse[source]

Bases: object

Typing stub for Pyramid response objects.

body: bytes
charset: str
content_length: int
content_type: str
headers: Dict[str, Any]
status: str
status_int: int
class kerno.web.pyramid.typing.PyramidSession[source]

Bases: object

Typing stub for a Pyramid session object.

flash(msg, queue: str = '', allow_duplicate: bool = True) None[source]
invalidate() None[source]
pop_flash() List[Any][source]
class kerno.web.pyramid.typing.RegistryStub[source]

Bases: object

Typing stub for a Pyramid registry object.

getUtility(provided, name='')[source]

Retrieve a Pyramid utility.

notify(*arg, **kw)[source]

Broadcast a Pyramid event.

queryUtility(provided, name='', default=None)[source]

Retrieve a Pyramid utility.

registerUtility(component=None, provided=None, name='', info='', event=True, factory=None)[source]

Register a Pyramid utility.

settings: Dict[str, Any]