[Web-SIG] [WSGI] mod_python wrapper: minimal first attempt

Phillip J. Eby pje at telecommunity.com
Fri Oct 15 07:47:22 CEST 2004

At 02:49 PM 10/14/04 -0700, Robert Brewer wrote:
>Phillip J. Eby wrote:
> > The "correct" way to do it would be to swipe whatever code mod_python
> > itself uses for that, although I wouldn't be surprised if it
> > uses exec also.  :)
> >
> > More likely, it uses '__import__', but for the prototype
> > version, why bother?
>Because it's easy:

Not if you haven't installed or even downloaded mod_python.  ;)

>I realized you don't need a separate handler function called
>wsgi_handler; mod_python is smart enough to notice when your handler is
>an unbound class method, and automatically forms an instance of your
>class (passing the request object), and then calling the bound method
>(again, passing the request). So I folded the handler code directly into
>ModPyHandler. Here's the latest version:

I think I'll stick with the version where they're separate.  It's easier to 
implement unit tests on the handler class if its __init__ method doesn't 
run the application.  Still, this looks like  it's in pretty good shape to 
pop into wsgiref.  Thanks for your help in fleshing it out.

More information about the Web-SIG mailing list