Open rogpeppe opened 7 years ago
Good points; I considered it a usability tradeoff (for simple cases you get your de/serialization for free).
I've been thinking of doing something more go-like and just throwing Marshal
/Unmarshal
and MarshalJSON
/UnmarshalJSON
on the macaroon object as the standard formts. If you want additional serializations (like the protobuf test I have in a branch here) you can just extend the Macaroon object with additional methods.
That seems good to me as long as it's documented how to get access to the data inside the macaroon so it can be serialised. Tbh I'm not sure that I'd extend the object - an external function could work ok, but I'm probably betraying my Go tendencies there.
It's definitely nice to have some serialisation available without having an extra import.
There's a cyclic dependency between pymacaroons and serializers. ISTM like this might be better avoided. Here are a few possible ways of doing so.