replacing ASP/VBScript with Python

Robert Brewer fumanchu at amor.org
Tue Feb 15 13:00:06 EST 2005


Peter Maas wrote:
> I have inherited an extremely messy ASP/VBScript application which
> is a pain for me to support. Now the customer is thinking about a
> redesign. I'd like to rewrite the whole thing in Python but the app
> has to meet some conditions like
> 
> - IIS frontend
> - MSSQL db server
> - Win32 authentication
> - No 'ugly' URLs like http://server/cgi-bin/frontend.cgi?main.py
> - Performance: intranet with ~ 1000 users

None of those sound like a problem.

> My personal preferences:
> 
> - I'd rather do this in plain Python than using e.g. Zope because I
>    fear the additional complexity of handling Zope and make it seam-
>    lessly work with IIS.

I had the same fear. :)

> - I'd like to do session handling in Python because ASP's session
>    object is quite limited and some of the ASP app's mess is caused
>    by trying to use it for compound data type storage. OTOH I could
>    pickle Python objects to a string and store that in an ASP session.

> In the meantime I have searched the internet and found plenty of
options:
> 
> - plain cgi with fastcgi and mod_rewrite for IIS to transform the URL
> - quixote cgi with fastcgi and mod_rewrite
> - Webware + wkcgi
> - Python ASP (registering Python with Pywin32 as ASP language)
> - mxODBC + SQL ODBC driver
> - pyADO + SQL MDAC driver
> 
> I'm now confident that it is doable and keen on finding out. The usual
> question: what is the one and best way to do it? ;)

Python ASP (pywin32), but put as little code as possible into the
ASP--make it just a stub to call the real Python app. That app will be
running persistently in the background, which should obviate most of the
need for session support. That's been my experience, anyway.

Here's an example (from
http://www.aminus.org/rbre/cation/html/admin/ASP.html):

<%@Language=Python%>
<%
from cation.html.uiasp import UserInterfaceASP
from cation import catapp

ui = UserInterfaceASP(catapp)
ui.request(Request, Response)
%>

The only downside is that ASP expects a physical file for every URL, so
you'll either have lots of dumb copies of the stub, or a single
dispatcher (and the ugly URL's you wanted to avoid). With a little
planning, you can have the stubs auto-generated.


Database side: try them all and see which is best with your dataset. ;)


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org



More information about the Python-list mailing list