asphalt.templating.component

class asphalt.templating.component.TemplatingComponent(renderers: typing.Dict[str, typing.Dict[str, typing.Any]] = None, **default_renderer_args)

Creates one or more TemplateRenderer resource factories.

Template renderers can be configured in two ways:

  1. a single renderer, with configuration supplied directly as keyword arguments to this
    component’s constructor (with the resource name being default and the context attribute matching the backend name)
  2. multiple renderers, by providing the renderers option where each key is the resource
    name and each value is a dictionary containing that renderer’s configuration (with the context attribute matching the resource name by default)

Each renderer configuration has two special options that are not passed to the constructor of the backend class:

  • backend: entry point name of the renderer backend class (required)
  • context_attr: name of the context attribute of the renderer resource factory
Parameters:
  • renderers (Optional[Dict[str, Dict[str, Any]]]) – a dictionary of resource name ⭢ constructor arguments for the chosen backend class
  • default_renderer_args – default values for constructor keyword arguments