Closed josejachuf closed 2 years ago
@josejachuf is this rapid-json
or orjson
? do you have any additional info on which field causes the TypeError?
Hi @gi0baro
it is python-rapidjson 1.6
I will try to pass the project that fails before Saturday
With orjson installed:
ERROR in handlers [/venv/lib/python3.8/site-packages/emmett/asgi/handlers.py:340]: Application exception: Traceback (most recent call last): File "/venv/lib/python3.8/site-packages/emmett/asgi/handlers.py", line 325, in dynamic_handler http = await self.router.dispatch(ctx.request, ctx.response) File "/venv/lib/python3.8/site-packages/emmett/routing/router.py", line 249, in dispatch return await match.dispatch(reqargs, response) File "/venv/lib/python3.8/site-packages/emmett/routing/dispatchers.py", line 72, in dispatch rv = self.response_builder(await self.f(reqargs), response) File "/venv/lib/python3.8/site-packages/emmett/pipeline.py", line 328, in flow output = await pipe_method(f, kwargs) File "/venv/lib/python3.8/site-packages/emmett/pipeline.py", line 234, in pipe return await next_pipe(kwargs) File "/venv/lib/python3.8/site-packages/emmett/pipeline.py", line 328, in flow output = await pipe_method(f, kwargs) File "/venv/lib/python3.8/site-packages/emmett/tools/auth/apis.py", line 277, in pipe return await next_pipe(kwargs) File "/venv/lib/python3.8/site-packages/emmett/pipeline.py", line 369, in flow return await pipe_method(f, kwargs) File "/venv/lib/python3.8/site-packages/emmett/tools/service.py", line 28, in pipe_request return self.encoder(await next_pipe(**kwargs)) TypeError: Type is not JSON serializable: LazyCrypt
@josejachuf that's not a bug, is intended. Password fields are not JSON serializable. I suggest you to filter what you serialize, with REST extensions you might exclude those fields with the rest_rw
dictionary in your model or a custom Serializer
.
Thanks @gi0baro
This works fine:
rest_rw = {
'institucion': True,
'password': (False, True)
}
I thought it was a bug, since in 2.3.1 it functioned well. The 2.4.x seems to be stricter in many things
Other bugs are happening with version 2.4.x. It is when I create a new user. I overwritten the email field so that it is not unique to avoid the problem [1]
email = Field(length=255)
When I make the post:
this error occurs
José
[1] https://github.com/emmett-framework/emmett/issues/428