Representer base classes.
Bases: object
Base class for all representers.
A representer knows how to convert an object into a representation of a particular MIME type (content type) and vice versa.
list of weak references to the object (if defined)
Bases: object
Registry for representer classes and representer factories.
list of weak references to the object (if defined)
Creates a representer for the given combination of resource and content type. This will also find representer factories that were registered for a base class of the given resource.
Registers a representer factory for the given combination of resource class and content type.
Parameters: | configuration (everest.representers.config.RepresenterConfiguration) – representer configuration. A default instance will be created if this is not given. |
---|
Bases: everest.representers.base.Representer
Base class for resource representers which know how to convert resource representations into resources and back.
This conversion is performed using four customizable, independent helper objects:
- The representation parser responsible for converting the representation into a data element tree;
- The data element parser responsible for converting a data element tree into a resource;
- The data element generator responsible for converting a resource into a data element tree; and
- the representation generator responsible for converting the data element tree into a representation.
Configures the attribute mapping for this representer.
Parameters: |
|
---|
Creates a data element from the given representation.
Returns: | object implementing everest.representers.interfaces.IExplicitDataElement |
---|
Extracts managed attributes from a resource and constructs a data element for serialization from it.
The default behavior can be configured with the “representer” directive (everest.configuration.representer()) by means of the “write_as_link” and “ignore” options of representer configuration objects (everest.representers.config.RepresenterConfiguration).
Creates a data element reading a representation from the given stream.
Returns: | object implementing everest.representers.interfaces.IExplicitDataElement |
---|
Creates a representation from the given data element.
Parameters: | data_element – |
---|
Extracts serialized data from the given data element and constructs a resource from it.
Parameters: | resolve_urls – If this is set to False, resolving URLs in the data element tree will be delayed until after loading has completed. |
---|---|
Returns: | object implementing everest.resources.interfaces.IResource |