ASP Questions

WaldekO osuchw at ecn.ab.ca.nospam
Fri Jul 14 03:10:46 EDT 2000


<gbreed at cix.compulink.co.uk> wrote in message
news:8kk616$5ck$1 at plutonium.compulink.co.uk...
> Here are some outstanding problems I have with ASP files written in
> Python.  Hopefully, some of you will have solutions.
>
> I can't write to session or application variables.  In VBScript, this is
> done like Session("key")="value".  In Python, for writing to a new key,
> that translates to assignment to None.  I found some documentation for
> fixing this in P*rlScr*pt, but still can't get it to work in Python.

The following syntax works for me but do not ask me why :-)

8<--------------------------------------------------------------------------
--------------
<%@language= "Python"%>

<html>
<head>

<%
domain= 'coentapps'
rw= Response.Write

if Session.Contents('db_conn'):
 conn= Session.Contents('db_conn')
 rw('exists<br>')
else:
 conn= Server.CreateObject("ADODB.Connection")
 conn.Open("servinfo")
 Session.Contents['db_conn']= conn
 rw('new<br>')

Session.Timeout= 5
rw(Session.SessionID)


sql = '''
  SELECT strServer, lngMemory
  FROM tblServerInfo
  WHERE strDomain= '%s'
  ''' %(domain)

rs = conn.Execute(sql)
srv, mem = rs.GetRows()
rs.Close()

out=''
for i in srv:
 out= out + '<br>' + str(i)
%>
</head>
<body>
<%=out%>
</body>
</html>
8<------------------------------------------------------------------------

waldemar





More information about the Python-list mailing list