Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
MessageSigning+CustomSerializers - Is it possible at all or no? Documentation is not clear in this front. #5960
Comments
|
please feel free to improve the docs! sorry for not noticing it earlier! |
Checklist
for similar or identical bug reports.
for existing proposed fixes.
to find out if the bug was already fixed in the master branch.
(If there are none, check this box anyway).
Related Issues and Possible Duplicates
Related Issues
Possible Duplicates
Description
Not sure if this is a bug report of enhancement but I can only select bug report for documentation, so here it goes. I'm trying to use MessageSigning with custom serializers. I have a single object type that is being returned by the tasks which I cannot change. For that object type I've added a JSONEncoder and a JSONDecoder, which are registered as:
from kombu.serialization import register register('task-result', lambda obj: json.dumps(obj, cls=TaskResultEncoder), lambda jst: json.loads(jst, cls=TaskResultDecoder), content_type='application/x-task-result', content_encoding='utf-8')Now, the message signing section of the Security documentation explains well how to set things up with the default json serializer. There's no word if it's possible to set custom serializers? Possibly through the serializer kwarg of setup_security? Now, I tried that, and it didn't work it still uses the buildin json serializer and whenever a TaskResult instance should be serialized I get a TypeError stating it's not serializable. Disabling MessageSigning solves the issue, but oh well I thought I might just ask.
Suggestions
Can you include these tiny bits in the documentation? There's a section for serializers, there's another section for MessageSigning but nothing regarding how to use those things together? I mean with custom serializers obviously.