[mod_python] Using publisher handler to generate directory index - how to do it in right and easy way ?

Peter Bittner peter.bittner at gmx.net
Thu Mar 27 02:17:57 EST 2003

Hi there!

> On Mon, 24 Mar 2003, Mateusz Korniak wrote:
> > When user requestes 'www.host.com/handler/foo' it works well.
> >
> > How to make handler.index(req) be handler of user requestes
> > 'www.host.com' ?

I have already tried to talk about this topic a while ago (maybe half a year
ago it was).

What I had proposed then, was to make the PublisherHandler handle a
'default' method, say func default(), which should be called automatically when a
request without a function name comes. In your examples this would be
'www.host.com/handler/' -- this would be handled like todays

This way one could make the web server handle, say, all 'index.py' files
like the defaults of a directory. (Comparable to the 'index.html' or whatever
someone sets to be called when no document is specified on access to HTML-files
on a web server.)

Having a PublisherHandler with a default function would then make it easy --
(look at the subject of Mateusz' message!) -- to create web projects in the
same simple manner as if there were only HTML-files:

 - An HTTP request to www.host.com would go to, say, www.host.com/index.py
(physically) and logically to www.host.com/index/default, respectively.
 - An HTTP request to www.host.com/mydir/ would in the same manner go to
www.host.com/mydir/index.py (physically) and logically to
www.host.com/mydir/index/default, respectively.

I think mod_python would only benefit from such a change to the
PublisherHandler's code. This would make mod_python (and thus Python itself) more
attractive to web designers and web programmers.

"Grisha" wrote:
> You can use a DirectoryIndex directive to point to a mod_python script.

Well, from my point of view this is only a workaround.
A general solution, however, might give Python the chance to become as
popular as PHP for web programming - after some time of course, not over night!

Please guys, note that this might be a change request that a lot of people
are waiting for, I think especially a lot of newbies to mod_python - newbies
that know other languages like PHP and (CGI-) Python beside others.


"Free software is like free speech, not free beer" (Richard Stallman)

+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!

More information about the Mod_python mailing list