Decoders
Decoders are used be fields to decode incoming data from
the API into a form usable in Python.
Those listed here are typically used by the fields
module. Unless you are creating your own field, you can probably
focus your attention there.
This is the inverse operation to that of encoders
.
-
class
repose.decoders.
IdToLazyModelListDecoder
(resource)
Decode a list of resource IDs into a lazily loaded list of
Resource
objects
-
__init__
(resource)
Initialise the decoder
Parameters: | resource (Resource) – The Resource class (not an instance) to which the
IDs listed relate. |
-
decode
(value)
Decode the value into a LazyList
.
Note
This assumes the destination
Resource
has an ID field
and that the endpoint is in the form /myresource/{myresource_id}
Todo
Consider refactoring out these assumptions