Python for ASP

Yann Schwartz yann at winwise.fr
Tue Nov 7 11:51:57 EST 2000


On Tue, 07 Nov 2000 12:02:47 GMT, perezmu at my-deja.com wrote:

>Hello,
>
>I am trying to write ASP scripting under python. I have been able to
>run simple scripts, but I do have a big problem when trying to access
>all the ASP Objects, since Microsoft documentation is focused to
>VBScript mainly.

Hello,

I'm using Python in ASP too, so maybe I might help

>
>For instance, it took me lots of net searches to find
>how to define a session variable (Session.SetValue("name") to write and
>Session.Value("name") to retrieve its value).
>
>Now I have a few questions for things I am not able to do:
>
>1) I want to redirect a page; according to the IIS documentation, the
>Response object should be used: Response.Redirect URL. I am not able to
>use this object from Python. Any one has done this before?

Actually, this is the VBScript way of writing things (you don't have
to use parens if you're calling a procedure).

To use Response.Redirect properly in Python, you should type :

Response.Redirect(myUrl)

(myUrl should be a string, and please not the capitalized object and
method).

>
>2) I request login to access to my pages via an NT net server. Is the
>login name stored somewhere in the ASP jungle?
>

The login is a user defined on the NT Web Server (or on the domain the
server is). So to authenticate on it, you need to provide a valid
login/pwd corresponding to a user in the nt box.

The login is stored in the SAM, not in a user file. You have to create
a legit user on the box in order to authenticate it against the box.

If you authenticate via Basic/plain text in IIS, the browser will show
a pop up. The user will have to enter a valid login.pwd pair.

If you authenticate via NTLM/integrated, the client must be IE4+, and
the login/pwd pair must be the same on the client and the server. The
authentication will be automatic (no popup, no login or pwd sent on
the wire).

>And now more general questions:
>
>1) Do you now any good resource for ASP programming in python?

Well, apart from the two or three pages you can find in the COM
PythonWin help, I'm afraid not.
I did some ASP in Python, and I will provide my source as soon as I
find it showable (the code still consists mostly of atrocious hacks).

>
>2) Is PHP any better?

Depends. ASP is not a language, but a framework, and it's very good at
what it does. But it's tied to NT, and offers no extensive library to
use (only plain HTTP Request/Response handling, state management and
access to COM - the latter being the strongest asset of ASP, imho).

PHP is a lot more comprehensive in its libraries, but it's also a
programming language, which is a mix between C-ish linguos and P*rl.
I'm not too fond of the language itself, actually.

In ASP, you can use Python (and P*rl) as a scripting language.

Many people here could tell you about the seemingly very good
pythonish solutions for Web apps, like Zope, but I never used them.



More information about the Python-list mailing list