Python + Win32ALL + ASP = Problems accessing Request/Response/Session/Application objects

Joe Salmeri JoeSalmeri at comcast.net
Wed Jul 24 12:40:21 EDT 2002


Max,

Thanks for the suggestion.

I'm really striving to separate as much as possible HTML and code.

I'm working on a framework such that the majority of my pages just have a
small block at the top to import and call python modules that do the
majority of the work.

Also, the framework that I have developed can be used for ASP pages OR for
CGI pages.  Even when used in ASP mode I don't really use much of ASP as I
have my own class that implements Python Server Pages which allows my
framework to be independent of the Web server used.  When in ASP mode, the
only real benfit is that the interpreter is not loaded/unloaded each time.
Other than that, all of the rest of the processing is handled via the
framework.

Currently I either pass in the value of globals() or the individual
Request/Response/Application/Session objects when they are needed but it
would be nice if I could just import the appropriate ASP components to make
those objects available.

I'm sure this must be possible, but I have been unable to fully trace those
objects to their creation.

Joe

"Max M" <maxm at mxm.dk> wrote in message news:3D3E6BCD.4010809 at mxm.dk...
> Joe Salmeri wrote:
>
> > 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.
>
>
> You would probably be better of in the long run if you used a facade to
> cover your code in.
>
> You would then only output finished html from the facade object.
>
> <%
>
> class PageFacade:
>
>      def __init__(self, message='blah blah'):
>          self.message = message
>
>      def blah(self):
>          return self.message
>
>      def update(self, req):
>          self.message = req.Form('message')
>          # 'insert message into theTable '
>
> f = PageFacade()
> save = Request.Form('save')
> if save:
>      f.update(Request)
>
> %>
>
> <html>
> here is some code that reads <%= f.blah()%>
> </html>
>
> This has a lot of advantages. Especially if you are writing database
> driven websites.
>
> regards Max M
>





More information about the Python-list mailing list