Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MessageSigning+CustomSerializers - Is it possible at all or no? Documentation is not clear in this front. #5960

Open
Display-Naming opened this issue Feb 15, 2020 · 1 comment

Comments

@Display-Naming
Copy link

@Display-Naming Display-Naming commented Feb 15, 2020

Checklist

  • I have checked the issues list
    for similar or identical bug reports.
  • I have checked the pull requests list
    for existing proposed fixes.
  • I have checked the commit log
    to find out if the bug was already fixed in the master branch.
  • I have included all related issues and possible duplicate issues in this issue
    (If there are none, check this box anyway).

Related Issues and Possible Duplicates

Related Issues

  • None

Possible Duplicates

  • None

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.

@auvipy
Copy link
Member

@auvipy auvipy commented May 16, 2020

please feel free to improve the docs! sorry for not noticing it earlier!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.