Accessing ASP-IIS objects in modules

Alex Martelli alex at magenta.com
Thu Jul 6 03:52:44 EDT 2000


<kellyk at my-deja.com> wrote in message news:8k0egu$ujn$1 at nnrp1.deja.com...
> I am using Python in ASP under Microsoft IIS. I can use the IIS objects
> like Server, Request and Response easily in my ASP script but cannot
> access them from a module.
>
> For example I want to use Response.Write("blah") from within a module
> (called from an ASP script) but Reponse is not a known object from
> there.
>
> Any ideas?

Passing these as arguments to the module's functions that you're
calling seems cleanest to me.  One alternative might be to add
references to them to the __dict__ of the module you want to use
them from, a la

    themodule.__dict__['Response']=Response

from the ASP script, but that doesn't seem very clear/clean... or
maybe something like:

    themodule.Response = Response

is better.  Similarly operating with the __builtin__ module might
be worst from the POV of clarity and cleanliness, but, if you have
LOTS of modules that MUST directly access such global objects...
(warning: haven't tried any of these -- check if they work!-).


Alex






More information about the Python-list mailing list