[mod_python] Problem getting the Publisher handler to return nothing

Graham Dumpleton graham.dumpleton at gmail.com
Sat Feb 2 16:08:18 EST 2008


No it is wrong as you are actually return a HTTP NO_CONTENT error
response, not a 200, ie HTTP OK response. The original FAQ entry may
have been a bit bogus and only applied to older mod_python versions as
I believe that returning an empty string as response is fixed in
3.3.1.

Graham

On 03/02/2008, Charles Collis <charles.collis at gmail.com> wrote:
> Fantastic, that did the trick!
>
> I have updated the FAQ accordingly
> (http://www.modpython.org/FAQ/faqw.py?req=all#2.19).
> Although the FAQ entry still mentions "forcing a 200 response" - and I'm not
> actually sure whether "raise apache.SERVER_RETURN, apache.HTTP_NO_CONTENT"
> is still forcing a 200 response or not. If that is now inaccurate perhaps
> some who knows could tweak the FAQ entry.
>
> Anyway, thanks for all the help, much appreciated.
>
> Charles.
>
>
> On Feb 1, 2008 12:20 AM, Graham Dumpleton <graham.dumpleton at gmail.com>
> wrote:
>
> >
> > On 01/02/2008, Charles Collis <charles.collis at gmail.com> wrote:
> > > Hadn't tried it before, but have now - unfortunately still no joy.
> > >
> > > If I return 'apache.HTTP_NO_CONTENT' my browser then shows a blank page
> with
> > > '24' at the top which presumably is the code for 'HTTP_NO_CONTENT'.
> > >
> > > If I raise the error:
> > >
> > > raise apache.HTTP_NO_CONTENT, apache.OK (whether I put ',apache.OK'
> there or
> > > not),
> >
> > Use:
> >
> >  raise apache.SERVER_RETURN, apache.HTTP_NO_CONTENT
> >
> > I am not sure though whether that will still trigger Apache to send a
> > default error page. You may have to use:
> >
> >  req.status = apache.HTTP_NO_CONTENT
> >  raise apache.SERVER_RETURN, apache.DONE
> >
> > to be absolutely sure that Apache doesn't further process it.
> >
> > Graham
> >
> >
> > > I get an error message in browser saying:
> > > 'TypeError: exceptions must be classes, instances, or strings
> (deprecated),
> > > not int'
> > >
> > >
> > >
> > > >
> > > >
> > > >
> > > >
> > > > Have you tried returning apache.HTTP_NO_CONTENT ?
> > > > According to [0],
> > > >
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
> > > this should
> > > > cause clients do nothing. As the behaviour of the client cannot be
> > > > controlled except for a status code in the header, this might be an
> > > > option easier than creating internal requests using Ajax.
> > > >
> > >
> > >
> >
> >
> >
> > > _______________________________________________
> > > Mod_python mailing list
> > > Mod_python at modpython.org
> > >
> http://mailman.modpython.org/mailman/listinfo/mod_python
> > >
> > >
> >
>
>


More information about the Mod_python mailing list