Set json encoder/decoder via config
Allows for custom serialization/deserialization and defaults to the built json encoder/decoder. This also sets the encoder/decoder for all places json.dump(s) and json.load(s) is used (i.e. gen_unique_id).
This allows you to use a custom encoder/decoder and still use unique=True on tasks.
TODO: add tests, and docs
Thanks! Any downside on doing it the way https://github.com/closeio/tasktiger/pull/92 or https://github.com/closeio/tasktiger/pull/22 do it? Those give additional flexibility since they allow for encoders/decoders other than JSON.
No downside, but I'm using flask/jinja2 and I just use the same encoder/decoder here.
One thing we could do, is specify the serialization method, and the encoder/decoders that go with it. So, something like:
self.config = {
'SERIALIZATION_METHOD': 'json',
'SERIALIZATION_ENCODER': JSONEncoder,
'SERIALIZATION_DECODER': JSONDecoder,
which would open the door to something like using yaml, or pickle.
I can add this if you like this weekend.