[mod_python] Understanding mod_python

Fabian Fagerholm fabbe at paniq.net
Sun Jul 14 11:33:07 EST 2002


Hello, World!

I've just begun to get to know Python and mod_python. So far, I like
what I see, but there are a few things that are a bit confusing. I
suspect it's just a matter of differing conventions - my previous
experience programming web applications is with Perl (cgi), PHP and Java
(Servlets).

Since I like to know exactly what I'm doing, I've read through all the
docs I could find, and browsed through the mailing list archives. I now
have two issues that I would like to bring up.


First, I would like to convince myself that I have understood the
Handler concept and the Publisher Handler. Therefore, I've made two
drawings based on the mod_python docs. The first drawing is
    http://www.paniq.net/fabbe/mod_python/Handler_order.ps
and it tries to show what happens when a request is made to Apache. In
particular, I'm trying to understand in which *order* the Handlers are
called and what each Handler is for.
The second drawing is
    http://www.paniq.net/fabbe/mod_python/Publisher_handler.ps
and it tries to show how the Publisher Handler handles a request. It
also shows the different parts of an URI from the Publisher's point of
view.

        * Are these drawings correct or have I misunderstood anything?
        * I would like to combine the drawings into one. Where would I
          attach the second drawing to the first?
        * I didn't quite understand how the __auth__, __access__ and
          __auth_realm__ stuff in Publisher works. I'm confused by the
          phrase "at each traversal step, the Publisher checks for...".
          I understand one object might refer to or contain another, but
          the benefits and practical use of this is is not clear to me
          and would need further explanation.
        * Could these drawings be beneficial to someone else? If so, I'd
          be happy to modify them for some particular purpose.


Second, while reading the mailing list archives, I found that many of
the posts were about how to build a web application with a sensible
structure (separating content from presentation), authorization, session
management etc. with mod_python. A very valid question IMO, because the
tutorial in the docs is quite sparse and shows an example that is mostly
achievable by using traditional CGI.
Using Python's OO features, it should be possible to create quite
complex web applications. As far as I can see, mod_python is able to
replace a Java Servlet-based solution with little effort. In fact, this
is my exact reason for looking at mod_python. :)

There were also some posts about a mod_python "cookbook", and another
poster suggested the on-line FAQ would be a good place for the
"recipes". I totally agree - well-written example code is the best way
to learn.
I'd like to suggest that a new category be created in the FAQ for these
snippets of example code.


Cheers,
Fabian Fagerholm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: This is a digitally signed message part
Url : http://mailman.modpython.org/pipermail/mod_python/attachments/20020714/e9156aa3/attachment-0003.bin


More information about the Mod_python mailing list