[Web-SIG] Python Web Modules - Version 0.4.1

Ian Bicking ianb at colorstudy.com
Mon Oct 4 22:55:46 CEST 2004

James Gardner wrote:
> Hello,
> I'd like to announce the release of the Python Web Modules 0.4.1. 
> This is the first time the modules have been publicly announced.
> http://www.pythonweb.org/     Feel free to download and have a play

> Back in March before the WSGI discussions there was some talk about 
> releasing better standard modules in Python for developing web 
> applications. This is my attempt to achieve that. These modules are 
> designed to be easily accessible to beginners or developers currently
>  using PHP or Perl whilst also offering lower level APIs for experts 
> to create powerful dynamic websites.

Now with WSGI, have you thought about refactoring some of these with
that in mind?  Some of these are really WSGI-neutral libraries, but 
others aren't.

The obvious place to start would be a WSGI backend.  It doesn't seem 
like Python Web Modules model will work well in a non-CGI environment. 
Not only does it seem to put everything in the global space (e.g., 
web.cgi), making it difficult to run in threaded environments, but all 
the examples run the request at the top level of the module, so that you 
have to reload the module to serve a second request.  This will paint 
you into a corner, as the API will be resistent to any other environments.

There are some other parts that might be good as middleware.  A deep 
stack of middleware starts to bring up issues of configuration and 
providing hooks... but that's another issue.  Anyway...

> Key features include:
> * web.auth     - Identity and identification handling. Users may have
>  multiple access levels to multiple applications. Sign in and 
> password reminder handling is built in.

This could be middleware, though obviously it requires a lot of user 
configuration.  If it's middleware you could share a single 
authentication system with different WSGI applications.  Some 
standardization in this case would be good -- starting with things as 
simple as environ['auth.username'] holding the string username.  But for 
now there's no standard, so you should use a custom prefix.

> * web.session  - Persistence using cookie or URL based session IDs 
> allowing any object which can be pickled to be stored using a 
> dictionary- like interface. Can be used with file or database 
> drivers.

This would be good as a WSGI middleware.  I have such a middleware at 
svn://colorstudy.com/trunk/WSGI/session.py , but the actual persistence 
and configuration is minimal.  But it might be helpful for thinking 
about how it might look as middleware.

> * web.error    - Enhanced error handling based on the principles of 
> the cgitb module. Plain text or HTML output to a file or browser. 
> Custom extension mechanism for email notifications and more.

This could also be a piece of middleware.  I feel like it's one of the 
more complicated kinds of middleware, but useful.  It could also be a 
bit of library code that applications can use, but I'd prefer it as 
middleware because you could configure it for multiple applications.

Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org

More information about the Web-SIG mailing list