Can you intercept the request in your browser and see if the content-type and body are actually correct? request.json_body only works on application/json -ish content types by default.
On Wed, Dec 10, 2014 at 9:31 AM, Rosciuc Bogdan <[email protected]> wrote: > I did use the request.json_body but it gives back an error. The value > dosen't reach the view... > > On 10 Dec 2014 16:31, "Wichert Akkerman" <[email protected]> wrote: >> >> >> On 10 Dec 2014, at 13:27, Rosciuc Bogdan <[email protected]> wrote: >> >> My view code: >> >> >> @view_config(route_name = 'declare_usage', renderer = 'declara.jinja2') >> @view_config(route_name = 'declare_usage_json', renderer = 'json') >> def declara_consum(request): >> >> #Removed code for simplicity >> >> val = request.POST.get('room') #I get a "None value in my html" if I >> change to request.json_body -> I get an error that there is no json to be >> parsed. >> >> >> You need to use request.json_body to get decoded JSON data. >> >> Wichert. >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "pylons-discuss" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/pylons-discuss/xSJUW4Bw4_0/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/pylons-discuss. >> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/pylons-discuss. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
