emmett-framework / rest

REST extension for Emmett framework
BSD 3-Clause "New" or "Revised" License
14 stars 2 forks source link

Posible bug in parse_params #7

Closed josejachuf closed 3 years ago

josejachuf commented 3 years ago

Hi @gi0baro it seems to me that there is a bug in parse_params. Maybe I am doing something wrong, but with the following it does not work

@users.update()
async def user_edit(dbset, rid):
    attrs = await users.parse_params()
    body_params = await request.body_params

    print(attrs, body_params)

attrs is always empty. I put the also the request.body_params to check

The output of the print is:

<sdict {}> <sdict {'id': 3, 'registration_key': 'blocked'}>

Best regards Jose

gi0baro commented 3 years ago

@josejachuf did you defined a parser class or you just relying onto model itself?

josejachuf commented 3 years ago

@gi0baro its on the same model

gi0baro commented 3 years ago

@josejachuf if I understood your code the model is from the Emmett's auth module. The default model has disabled read-write permissions for the registration_key field, so you can add to your user model the relevant configuration as stated by doc:

rest_rw = {
    'registration_key': True
}
josejachuf commented 3 years ago

It was that. Thank you so much