Closed tumluliu closed 7 years ago
well, I found the reason. the self.serialize
was not even called in the to_dict
function in helpers.py
. I made a monkey patch in my forked version here: tumluliu/flask-restless@ 47693f6f67d638d8dac1d7350bba215482584072 .
not intended to commit a PR because the custom serialization strategy was totally changed in the latest version (1.x.x)
I found that the custom serializer doesn't work on collections API endpoint, while it works well on single item endpoints. I am using 0.17 of flask_restless.
In my case, when access https://luliu.me/tracks/api/v1/trackinfo/2, I can get
as expected, which means the serializer works. But when I access https://luliu.me/tracks/api/v1/trackinfo, I got such errors:
That means that there is a column of INTERVAL(postgresql) type can not be serialized with default serializer. That's a very ridiculous error because I provide the custom serializer when creating the API:
where the
trackinfo_serializer
is defined as:The full source codes are quite simple and available in the https://github.com/tumluliu/tracks-rest-api repo. I am wondering if there is anything changed w.r.t the custom serialization in the latest version of flask_restless. I noticed that there is a new
serializer_class
introduced, but I don't think theserialize_many
function is for this case. Thanks a lot!