|
Nick
nick at dd.revealed.net
Mon Jun 14 13:37:23 EDT 2004
Good point, there. I needed to do something similar a while ago, and after
trial and error I figured it out. It might be a helpful FAQ item.
Nick
Indrek Järve wrote:
> Grisha,
>
> Thanks, that did it!
> Maybe this behaviour should be explained in a bit more detail in the
> documentation for the future users? While now knowing this I can
> semi-understand it from "Overview of a Request Handler" and "Request
> Object/Request Members", it still seems a bit vague ;)
>
> Regards,
> Indrek
>
> On Mon, 2004-06-14 at 20:24, Gregory (Grisha) Trubetskoy wrote:
>
>>Indrek
>>
>>If you want Apache to handle the error, you return it the error code. This
>>will result in the behaviour you are seeing (an error page and a status of
>>200).
>>
>>If you do not want Apache to handle the error (and in your case you do
>>not), then set req.status yourself, write the necessary output (e.g. some
>>html describing the error) if any, and return apache.OK.
>>
>>So the code you're looking for is:
>>
>>def handler(req):
>> req.status = apache.HTTP_MULTI_STATUS
>> req.content_type = 'text/plain; charset=UTF-8"
>> req.write('hi!')
>> return apache.OK
>>
>>This may seem confusing at first, but if you think about it it actually
>>makes pretty good sense. :-)
>>
>>Grisha
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
|