[Web-SIG] Defining a standard interface for common web tasks

David Fraser davidf at sjsoft.com
Fri Oct 24 03:33:27 EDT 2003


Steve Holden wrote:

>[David Fraser]
>  
>
>>Ian Bicking wrote:
>>
>>    
>>
>>>On Friday, October 17, 2003, at 03:51 PM, Bill Janssen wrote:
>>>
>>>      
>>>
>[...]
>  
>
>>>>2) A standard Apache plug-in.  Does mod_python fill this
>>>>        
>>>>
>>role?  (Should
>>    
>>
>>>>this really be part of the stdlib?)  It would be useful if the APIs
>>>>used here were similar to those used in the API support.
>>>>        
>>>>
>>>mod_python pretty much fits this.  I don't see any reason
>>>      
>>>
>>to develop
>>    
>>
>>>anything else (at least in terms of Apache integration).  I don't
>>>think it would make sense as part of the stdlib -- it depends on
>>>Apache just as much as Python, and people install Apache in
>>>      
>>>
>>all sorts
>>    
>>
>>>of different ways.
>>>      
>>>
>>Yes, in Apache, mod_python is pretty much it. As far as the
>>API goes, I
>>think mod_python is an important one to look at at the design stage
>>rather than trying to fit an API to it later, since Apache is fairly
>>standard and mod_python is used by lots of different people.
>>You don't
>>want mod_python to have to be rewritten to comply with the API later.
>>
>>    
>>
>I'm not sure that we should be arguing to include something that depends
>on a specific environment like Apache in the standard library. We should
>certainly be trying to promote a standard of some sort, however, which
>seems to conflict.
>
>I see the parallel more as being with the DB API - there are Oracle
>modules and ODBC modules (which are cross-engine) and SQL Server modules
>and so on. What we need is something to provide closely similar
>interfaces to different web server engines - whether those engines are
>in pure Python or external components.
>  
>
Agreed. What I'm saying isn't that mod_python should be put in the 
standard library, but that the design of the web server API should be 
carefully done so that it doesn't require major changes to mod_python etc.

>The one problem I see with mod_python is its defaulting behavior - you
>can get the same content several different ways. Specifically, the
>following URLs
>
>	http://server/
>	http://server/index.py
>	http://server/index.py.index
>
>all refer to the same content, and this makes it rather difficult to
>come up with a scheme for producing sensible relative URLs -- the
>browsers don't always interpret the path the same way the server does --
>which in turn can make it difficult to produce easily portable web
>content.
>  
>
Hmmm ... looks like you are using AddHandler for .py files. I generally 
find that placing the Python files outside of the web directory, in 
libraries, works better. Then you can use SetHandler to get mod_python 
to handle everything, or AddHandler for specific file types to get it to 
handle some URLs. It makes more sense to me to have a URL of index.htm 
rather than index.py (why should the user care what I'm using to produce 
the file?)

Hope that is relevant and/or helpful

David




More information about the Web-SIG mailing list