Python + Win32ALL + ASP = Problems accessing Request/Response/Session/Application objects
Joe Salmeri
JoeSalmeri at comcast.net
Tue Jul 23 22:32:26 EDT 2002
Python = 2.2
Win32All = build 146
OS = XP Professional
How are the ASP Request/Response/Session/Application objects accessed in a
module that is imported in an ASP file WITHOUT passing them in as paramaters
to each of the functions defined in that module? I have attempted to track
down the creation of those objects but have been unable to trace them to the
source of their creation.
Here is an example of what I am trying to do (all thoughts are greatly
appreciated)
----- begin sample.asp ----
<%@language="Python"%
<%
# At this point the Request/Response/Session/Application objects exist in
the global namespace.
# Also there is a __ax_main__ module and a ax global that contains that
Request/Response/Session/Application objects
# The __ax_main__ module and ax global appear to be created by creating an
instance of win32com.axscript.client.pyscript.PyScript()
import sample_util
%>
---- end of sample.asp ----
---- begin sample_util.py -----
# How can the Request/Response/Session/Application objects be accessed by
this module WITHOUT passing them
# in as parameters to any functions defined here?
def sample_func_1(Request, Response, Session, Application):
# this would allow you to reference the objects but each function would
need to do this
return
def sample_func_2(Request, Response, Session, Application):
# this would allow you to reference the objects this function would need
to do this too
return
def sample_func_3():
# I want to do something like
import ax
ax.Response.Write('blah blah')
# OR
from ax import Request, Response, Session, Application
Response.Write('blah blah')
---- end sample_util.py ----
More information about the Python-list
mailing list