[mod_python] Directory indexing problem

Byron Ellacott bje at apnic.net
Mon May 24 09:48:05 EDT 2004


On Fri, 2004-05-21 at 20:06, Richard Whitehurst wrote:
> I now see that It's that old chestnut
> SetHandler/AddHandler/apache.DECLINED:
> No use returning apache.DECLINED from a 'set' handler as there no
> other handler
> to do the work and will give 404 in some/all(?) circumstances.

.htaccess:
SetHandler mod_python
PythonHandler index

index.py:
from mod_python import apache

def handler(req):
    return apache.DECLINED

level25.png:
image/png data

$ wget -S http://localhost:8080/test/level25.png
 1 HTTP/1.1 200 OK
 3 Server: Apache/2.0.47 (Debian GNU/Linux) mod_python/3.1.3
Python/2.3.3
10 Content-Type: image/png
08:43:19 (153.38 MB/s) - `level25.png.1' saved [26537/26537]

(trimmed wget output)

The only difference between SetHandler and AddHandler is that AddHandler
requires one or more extension arguments to map the handler to, while
SetHandle applies to all matching files (where 'matching' means 'files
that fall under the domain of the containing <Directory> or <Location>
section.'

(Noting that a .htaccess behaves mostly as a <Directory>.)

-- 
bje



More information about the Mod_python mailing list