bag.web.pyramid.apps.views module

Useful base views, functions and decorators for Pyramid.

class bag.web.pyramid.apps.views.BaseView(request)[source]

Bases: object

Base class for views.

tr

The translator of the localizer of this request.

url(name, *a, **kw)[source]

A route_url that is easier to use.

class bag.web.pyramid.apps.views.BaseViewForDeform(request)[source]

Bases: bag.web.pyramid.apps.views.BaseView

dict_to_model(adict, model)[source]

Update model with adict.

model_to_dict(model, key_provider)[source]

Return an appstruct dict with values taken from the model.

key_provider can be:

  • a comma-delimited string of key names,

  • a list of strings representing key names,

  • a colander.Schema (or subclass).

class bag.web.pyramid.apps.views.ChameleonBaseView[source]

Bases: object

Base view mixin class for projects that use Chameleon with macros.

macro(template, macro_name)[source]

Load macros from any Chameleon template.

If settings[‘reload_templates’] is false, also memoize the macros.

macro_cache: Dict[str, Any] = {}