[mod_python] How do you know if the current request is an internal redirect?

Dan Eloff dan.eloff at gmail.com
Mon Sep 4 18:51:44 EDT 2006

On 8/18/06, Gavin Panella <gavin at premolo.com> wrote:
> > > How do you know in your handler if this is an internal redirect?
> > > req.prev is set to a req object even if there was no internal
> > > redirect.
> >
> > In the main request req.main is None, and in a subrequest it points back to
> > the main request, so just test if it's not None.
> Actually, this isn't true, for me at least. I've been doing internal
> redirections with mod_python 3.1.4 and Apache 2.0.58 on Linux and getting the
> following:
> Main request:
>         req.main is None
>         req.prev is None
> Subrequest:
>         req.main is None
>         req.prev is not None

I was just experiencing that, hence why I looked up this conversation
again. Thank you for confirming. Maybe the behaviour has changed,
because I seem to recall req.main working as you previously mentioned.


More information about the Mod_python mailing list