You could also just set the type of error in the status_int and return the 
vars and use the json renderer.

request.response.status_int = HTTPUnprocessableEntity.code


On Monday, March 31, 2014 5:11:20 AM UTC-4, Chung WONG wrote:
>
> For example, there is a view returns a http exception to a request:
>    @view_config(route_name='route', renderer='json', request_method='GET')
>     def view(request):
> *        return HTTPUnprocessableEntity(detail='details', 
> comment='comment', body_template='body_template')*
>
> it returned a full html page
> *<html>* *<head>* *<title>422 Unprocessable Entity</title>* *</head>* 
> *<body>* *<h1>422 Unprocessable Entity</h1>** body_template* *</body>*
> *</html>*
> is it possible to make the return as a JSON so that the frontend can 
> extract the error message easily?
>
> thanks
>

-- 
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 pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to