Nick wrote ..
> Graham Dumpleton wrote:
> > Yes, effectively the same as what I was doing. As I highlighted in prior
> > email though about request cache implementations, not sure it would
> > work correctly if an internal redirect occurred and both original handler
> > and target of internal redirect had registered request object. One needs
> > to use a stack for self.local.req and push/pop the request object on
> to
> > it.
> 
> Hm, very well.  I never really considered the case of using the internal
> redirect.  I'm an "old school" mod_python user, so I'm not up on all the
> new features apache2 brings to the table.  Reading the docs, I would 
> suppose you could make use of req.prev somehow in these cases rather 
> than manually keeping a separate stack?  E.g. in my free_req function,
> do "self.local.req = self.local.req.prev" (assuming if there hasn't been
> an internal_redirect, req.prev is None).

Unfortunately you can't do that as all Python request objects in that
chain are created fresh for the handler which is the target of the
internal redirect. When the internal redirect returned, the cached
would then be actually different to the original. It would still return
the same underlying Apache data, but any extra stuff added to the
request object from Python code wouldn't be accessible.

Graham

Reply via email to