[mod_python] using callable classes instead of plain functions in handlers

Terry MacDonald terry.macdonald at dsl.pipex.com
Mon Oct 4 12:28:49 EDT 2004


> I just built a very comprehensive content management system with
> mpservlets that does what you want.  ONE servlet manages the whole
> site.  It does this via PATH_INFO.  If you're not familiar with it you
> should find out about it because it can be a very powerful tool.
> Briefly...
> 
> If you have a URI, /some/dir/target, and a request comes in for
> /some/dir/target/x/y/z then /some/dir/target will get the request with
> PATH_INFO set to x/y/z.  Think of it as extraneous path information
> that was passed along with the request.  Many systems use this to
> create "clean" urls.
> 
> Now, if you have a servlet, /some/dir/myservlet, and a request comes
> in for /some/dir/myservlet/this/file, then myservlet will have an
> instance variable, path_info, set to ['this', 'file'].  (Aside: if a
> request has no PATH_INFO then the path_info instance variable is set
> to an empty list.)  Using this mechanism you can manage a site with a
> few servlets using path_info as a lookup into a database or a
> filesystem.

Thanks for the reply, Dan. I commend you in your support efforts.

If you use servlets the way you have described what do you see as the
the differences and/or benefits servlets has over the publisher handler,
which effectively does the same thing?

cheers
-- 
Terry
Registered Linux User # 311806




More information about the Mod_python mailing list