Events are registered in the context of an application via

Subscribers typically have the signature subscriber(event). If subscriber keyword args were passed to add_subscriber, then the signature for the subscriber would be subscriber(event, **kwargs).

Every event object will have an app attribute. Other attributes are event dependent.


Emitted when an application is fully configured.

These events can be registered in the usual way by calling There’s also a convenience method for this:

Attributes: app.

class, request)[source]

Emitted when an application receives a new request.

This is not emitted for static file requests.

Attributes: app, request.

class, request, response)[source]

Emitted when the response for a request is created.

This is not emitted for static file requests.

If there’s in exception during request handling, this will not be emitted.

Attributes: app, request, response.

class, request, resource)[source]

Emitted when the resource is found for a request.

Attributes: app, request, resource.

class, request, context)[source]

Emitted when the context for a template is created.

The template context is whatever data will passed to the template. E.g., for Mako, it’s a dict.

This is emitted just before the template is rendered. Its purpose is to allow additional data to be injected into the template context.

Attributes: app, request, context, *args, **kw)[source]

Decorator for adding event subscribers.

Subscribers registered this way won’t be activated until is called.


def on_resource_found(event):