I have a custom class Passport that contains the active user identity and permissions. I used to store it in session just like this:
p = Passport()
p.do_something_fancy()
session["passport"] = p
and it just worked. Now, after server upgrade, I am receiving this error:
TypeError: <userman.Passport instance at 0x7f06e9356f38> is not JSON serializable
I guess it is connected to some upgrades in Flask that now require the object to be JSON-serializable to be stored in session. But how do I properly make an object JSON-serializable? Perhaps I have to provide a method for serialization and also a method for deserialization, to restore the object state when it's being loaded again?