[mod_python] setting content_type intelligently

Michael C. Neel neel at mediapulse.com
Thu Feb 5 14:33:02 EST 2004


> > As a hail mary play, I believe there is a phase of the request where
> > apache goes searching the disk for the file, separate from 
> the content
> > handling phase.  This is where DocumentRoot, Alias, 
> ScriptAlias, etc are
> > all handled.  You could handle this yourself, and when you 
> image request
> > comes in, set the required pieces of the request data to state the
> > location of the image on disk.  The your content handler 
> would return
> > apache.DECLINED, and then apache mime magic would take over.
> 
> Let me see if I got this right...your theory is that, after
> determining I really want apache to handle the request, I should be
> able to tweak the req such that returning apache.DECLINED will work
> even in a <Location ...>.
> 
> Sounds like a great theory to me.  Does anyone know how to do this?
> 

Well, looking at the documentation mod_python may not be able to do this
for you.  The handler you want is PythonTransHandler, but mod_python
makes the req.uri and req.filename read only, which is what you need to
change.  You could test this to see if the docs are in error.

Since I have mime-phobia I would just fall back on mod_perl to handle
this phase, and switch if/when mod_python could be used instead.

mike



More information about the Mod_python mailing list