[mod_python] Re: Mod_python Digest, Vol 42, Issue 4

Blair P. Houghton blair at houghton.net
Sat Sep 2 01:51:44 EDT 2006

Graham Dumpleton <grahamd at dscpl.com.au> wrote:
> On 01/09/2006, at 12:01 PM, Blair P. Houghton wrote:
> It does, in as much as the example shows that is the case. It just does
> not spell it out in words as a requirement. Ie., it always uses  
> "form.py/email".

Documentation needs to explain what is going on.

> Referencing just the script and no function name will work provided that
> the code file contains a function called index().
> That you use a name "handler" suggests you are getting a bit muddled
> with the difference between basic mod_python handlers, where response
> handler is always called handler() and name of function doesn't need  
> to be
> in the URL and mod_python.publisher where with the exception of index(),
> the function does have to be in the URL.

I think that the fact that in one setup the default is handler()
and in another it is index(), and that this difference is not
made explicit early in the documentation, is the problem.

Anyone who, like me, tries out the simpler mechanism and learns
that the default is handler(), won't be expecting it to change
when moving to the publisher mechanism.  I wanted to use the
script that I had already been running, because changing more
than one thing at a time is a recipe for error.  Of
course, what happened is that the documentation just expected
I'd throw away everything I'd done before and blindly type in
the publisher example script.  Which is overly complicated for
its purpose, which of course is a recipe for error.  So
of course I didn't do it that way.

>>Note that the
>>'.py' suffix must be included also.
> Not necessarily. Whether this is the case will depend on how Apache is
> configured for MultiViews. Try the configuration:
>    AddHandler mod_python .py
>    PythonHandler mod_python.publisher
>    PythonDebug On
>    Options +MultiViews
>    MultiviewsMatch Handlers
>    AddType text/html;qs=1.0 .py
>    AddType text/html;qs=0.9 .html
>    AddType text/plain;qs=0.8 .txt
> On mod_python web site, do searches for "MultiViews MultiviewsMatch" and
> "MultiviewsMatch DirectoryIndex" for other discussions on this topic.  
> Ones
> which include most are probably:
>    http://www.modpython.org/pipermail/mod_python/2006-June/021435.html
>    http://www.modpython.org/pipermail/mod_python/2006-March/020501.html

This is interesting, but highly non-intuitive in the context of
"just trying to get the thing running so I can start to do some
productive work".

>>I believe that the document from the live/current tree should be  
>>moved to the document in the live/mod_python-
>>3.2.10 tree ASAP so that people won't be caught by this any more.
> Those two trees are the same document, just different parts of the  
> same document.

Interesting.  The "quick-start" page is a lot less "quick" than
the "introduction" one.  And with that hairy example isn't even
close to quick.  I think anything referring to a "quick start"
in the document should point right at the publisher introduction
page.  Which should use the default index() function and point
out accessing it both explicitly and as a default in the URI.
Because nobody who's trying to get a "quick start" is going to
read anything called "Traversal" in the manual.

> Both AddHandler and SetHandler approaches can work, but they are used  
> for
> different reasons.

Hmm.  I didn't even notice that one was AddHandler and the other
was SetHandler.

So here we have the documentation using two different ways to do
the same thing, without, again, pointing out why, in a place where
it would be of the most possible value to be explicit about it.


More information about the Mod_python mailing list