[mod_python] Apache directory listing

Graham Dumpleton graham.dumpleton at gmail.com
Mon May 28 07:22:21 EDT 2007


On 28/05/07, Aaron Gallagher <habnabit at gmail.com> wrote:
> Okay, I'll try that.
>
> But, what exactly is the purpose of a PythonFixupHandler? The
> documentation doesn't have much to say, but I assume it's for doing
> URL rewriting and redirection.

Potentially. It is one of a number of phases and is a sort of catch
all or last chance phase before actual response handler is executed.
For a very technical description of the whole Apache request-response
loop see:

  http://www.fmc-modeling.org/projects/apache/html/4_4Request_Response_Loop.html

If you really want to understand how Apache works, that whole document
is quite a good read, albeit probably more in depth than most people
would care for.

Graham

> On May 28, 2007, at 3:44 AM, Graham Dumpleton wrote:
>
> > Arrgghh, mistook mime type for handler.
> >
> > Trying again, although not sure this will work, but might be able
> > to say:
> >
> >  req.handler = "httpd/unix-directory"
> >  return apache.DECLINED
> >
> > The reason this might not work is that mod_python registers itself as
> > a middle handler as does the autoindex module. Because the autoindex
> > module is inbuilt, it probably gets processed prior to mod_python
> > handler so too late to do the above.
> >
> > Thus, your only choice would be to provide a fixuphandler which undoes
> > the SetHandler just for the request against the directory and triggers
> > autoindex instead. Ie.,
> >
> >  def fixuphandler(req):
> >    if req.content_type = "httpd/x-directory":
> >      req.handler = "httpd/unix-directory"
> >    return apache.OK
> >
> > Enable this using appropriate PythonFixupHandler directive.
> >
> > Graham
> >
> > On 28/05/07, Aaron Gallagher <habnabit at gmail.com> wrote:
> >> I get a 404 Not Found error.
> >>
> >> On May 28, 2007, at 3:22 AM, Graham Dumpleton wrote:
> >>
> >> > What happens if you return apache.DECLINED.
> >> >
> >> > Graham
> >> >
> >> > On 28/05/07, Aaron Gallagher <habnabit at gmail.com> wrote:
> >> >>
> >> >> Is there a way to tell Apache to give a directory listing? I'm
> >> using
> >> >> SetHandler on a directory, and in some cases, I don't need to do
> >> >> any special
> >> >> handling, so I'd like Apache to just list the contents of the
> >> >> directory so
> >> >> that I don't have to write my own way of doing it.
> >> >>
> >> >> Just returning apache.OK has Apache send a document of MIME time
> >> >> httpd/x-directory with content length 0.
> >> >>
> >> >> Aaron Gallagher
> >> >> <habnabit at gmail.com>
> >> >>
> >> >>
> >> >> _______________________________________________
> >> >> Mod_python mailing list
> >> >> Mod_python at modpython.org
> >> >> http://mailman.modpython.org/mailman/listinfo/mod_python
> >> >>
> >> >>
> >>
> >> Aaron Gallagher
> >> <habnabit at gmail.com>
> >>
> >>
> >>
>
> Aaron Gallagher
> <habnabit at gmail.com>
>
>
>


More information about the Mod_python mailing list