Oh, looks like it works on an endpoint level; not sure how to get rid
of the XML style comment though <!-- -->

Output from curl:

> GET /arbg/error HTTP/1.1
> Host: localhost
> Accept: */*
>

< HTTP/1.1 404 NOT FOUND
< Set-Cookie:  session_id_arbg=127.0.0.1-d5613ca1-ff65-4c0e-a5ce-737c6024655d;
Path=/
< Content-Length: 555
< Content-Type: text/html; charset=UTF-8
< Date: Wed, 06 Mar 2013 09:39:20 GMT
< Server: Rocket 1.2.6 Python/2.7.3
< Connection: keep-alive
<
{"error": "unauthorized_client"}<!--
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//-->


FYI: I am running web2py version 2.4.1-alpha.2+timestamp.2013.02.21.10.15.58




On Wed, Mar 6, 2013 at 8:15 PM, Niphlod <niph...@gmail.com> wrote:
> what did you expect ?
>
> On Wednesday, March 6, 2013 9:37:26 AM UTC+1, Alec Taylor wrote:
>>
>> How do I raise HTTP errors as JSON?
>>
>> My attempt:
>>
>> In [1]: import json
>>
>> In [2]: from gluon.http import HTTP
>>
>> In [3]: raise HTTP(412, json.dumps({'error': 'must accept terms'}))
>>
>> ---------------------------------------------------------------------------
>> HTTP                                      Traceback (most recent call
>> last)
>> <ipython-input-11-4878ff8c2cfc> in <module>()
>> ----> 1 raise HTTP(412, json.dumps({'error': 'must accept terms'}))
>>
>> HTTP: 412 PRECONDITION FAILED
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to