[mod_python] MultiViews and mod_python

Daniel J. Popowich dpopowich at mtrsd.k12.ma.us
Sun Jun 6 22:47:53 EDT 2004


If content negotiation is being used (mod_negotiation) and a directory
has MultiViews turned on with the Options directive, then certain
handlers will not work: you will get a 404 error and you will see
something like this in your apache error log:

    [Sun Jun 06 20:44:44 2004] [error] [client 127.0.0.1] Negotiation:
    discovered file(s) matching request: /some/dir/foo

This can happen with handlers that allow the requests to reference
files without a full filename.  Typically, this will be handlers that
don't require the file extension so as to allow "clean" URLs.  For
example, when using the publisher handler, if I have a module named
foo.py that has a function named bar defined, then these two requests
should both work:

   http://myhost/some/dir/foo.py/bar
   http://myhost/some/dir/foo/bar

But if /some/dir has MultiViews on (or a parent directory has it on
and it's not explicitly turned off in a subdirectory) then only the
first one will work, the second will generate a 404 error.

The only solution seems to be to explicitly turn off MultiViews:

    <Directory /some/dir>
      Options -MultiViews
      SetHandler mod_python
      PythonHandler mod_python.publisher
    </Directory>

This is the behaviour I'm witnessing.  Should this be correct?  Why is
mod_negotiation poking its nose in where it's not wanted, i.e., in a
directory using SetHandler?

Daniel



More information about the Mod_python mailing list