[Webware-discuss] Re: [ANNOUNCE] Webware for Python 0.5

Terrel Shumway tshumway at transafari.com
Fri Mar 2 20:07:08 CET 2001

Geoff Talvola wrote:

> Chuck Esterbrook wrote:
> > "Don Tuttle" <tuttledon at hotmail.com> wrote in message
> > news:<fFCn6.13480$Z8.1902263 at typhoon.southeast.rr.com>...
> > >"Chuck Esterbrook"
> > > >    * Python Server Pages (PSP, similar to ASP, PHP and JSP)
> > >I 'm trying to get a handle on why I would want to use PSP on WinNt with
> > >IIS.  What's the difference/advantage to using PSP compared to using ASP
> > >with embedded Python script?
> > >Don
> I recall that ASP with Python places limitations on what you can store in session variables.  For example, if you try to place a dictionary into a session variable you'll get an error like "TypeError: Objects of type 'dictionary' can not be converted to a COM VARIANT".  Generally, only "simple" types like integers, floats, strings, and lists of them can be placed into a session variable.  WebKit/PSP has no such restrictions.

You can solve this problem easily with pickle.

The larger problem with using Python in ASP is that the ASP processor removes all "non-significant" white space before it sends the code to the interpreter.  Python's idea of "non-significant" white space is much more restrictive than other interpreters.  The easiest way to fix this would be to modify the python scanner to use non-white tokens to represent indents and outdents, then use your custom interpreter for the ASP.

> On the flip side, one possible advantage of ASP with Python is that you might be able to take advantage of 3rd-party extensions that are designed to only work with ASP.  I don't know if such things exist.  I happen to be using a 3rd-party COM component in my web pages to draw dynamic graphs.  The component was designed for use with Visual Basic and Active Server Pages, but it works great with WebKit too.

Third party extensions designed to work with ASP?  I think the model MS encourages is to to put such logic into COM components, which are just as easily accessible to Python as they are from VBScript.  In general, as your app grows you would put more of it into separate components.  This is a Good Thing for PSP too.  Keep as much logic out of *SP as possible.  The most complicated thing you should put into a template page is a simple loop to build a table.  Most of it should be HTML with an occassional <%=object.property%> or
<%=object.method()%>. The advantage Python gives you here is that it is much easier to do such refactoring if you can create components without messing with COM.

> ASP/Python also has the dubious advantage of being an easier sell within a corporation than WebKit/PSP, which may or may not be important to you...

It will be interesting to see how well Webware could integrate into IIS with a new IISAdapter (currently not even vaporware).  Python for .NET will give it some marketing muscle.  I can see a lot of VB developers moving to python when that gets solid.

    -- Terrel

More information about the Python-list mailing list