By default, this library uses the default pickle and json modules of the standard Python installation to perform conversion to and from those formats.
Sometimes there may be a wish to use a different implementation of those functions (for example, cPickle or a faster JSON encoder/ decoder).
There are two functions available to change the default Pickle and JSON converters.
Note that these immediately affect all Connection objects. If you wish to have a finer grained control over which object uses which converters, you may wish to consider writing your own Transcoder implementation instead.
Modify the default JSON conversion functions. This affects all Connection instances.
These functions will called instead of the default ones (json.dumps and json.loads) to encode and decode JSON (when FMT_JSON is used).
Parameters: |
|
---|---|
Returns: | A tuple of (old encoder, old decoder) |
No exceptions are raised, and it is the responsibility of the caller to ensure that the provided functions operate correctly, otherwise exceptions may be thrown randomly when encoding and decoding values
Modify the default Pickle conversion functions. This affects all Connection instances.
These functions will be called instead of the default ones (pickle.dumps and pickle.loads) to encode and decode values to and from the Pickle format (when FMT_PICKLE is used).
Parameters: |
|
---|---|
Returns: | A tuple of (old encoder, old decoder) |
No exceptions are raised and it is the responsibility of the caller to ensure that the provided functions operate correctly.