asphalt.serialization.component
- class asphalt.serialization.component.SerializationComponent(backend, resource_name='default', options=None)
Bases:
Component
Creates a serializer resource.
The serializer resource will be available in the context as the following types:
CustomizableSerializer
(if the serializer implements it)its actual type
- Parameters:
backend – the name of the serializer backend
resource_name – the name of the serializer resource
options – a dictionary of keyword arguments passed to the serializer backend class
- async start(ctx)
Perform any necessary tasks to start the services provided by this component.
- In this method, components typically use the context to:
add resources and/or resource factories to it (
add_resource()
andadd_resource_factory()
)request resources from it asynchronously (
request_resource()
)
It is advisable for Components to first add all the resources they can to the context before requesting any from it. This will speed up the dependency resolution and prevent deadlocks.