[mod_python] from mod_python import apache

Iker Arizmendi iker at research.att.com
Fri Aug 20 08:57:22 EDT 2004


I also think I have misunderstood how mod_python
does its thing. At first I thought that the req
object was global object and a member of mod_python
that gets appropriately populated before my PSP
code executed. This led me to believe that I could
import it and use it in an arbitrary module provided
I was running within Apache (sort of like the COM's
context object).

Regards,
Iker


Nic Ferrier wrote:
> Iker Arizmendi <iker at research.att.com> writes:
> 
> 
>>Declaring variables as global within a function
>>definition seems to be a syntax error. 
> 
> 
> http://docs.python.org/ref/global.html
> 
> 
> 
>>But even if I moved the declarations to module scope the global
>>variable in the importing module is still not visible in the module
>>that is imported (which seems reasonable, otherwise modules would
>>risk polluting the namespace of modules they imported).
> 
> 
> You're right. The module that is imported would have to import your
> main module right back.
> 
> What you seem to want is dynamic scope á la lisp.
> 
> I don't know if it's possible to do dynamic scope in python.
> 
> 
> Nic
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
> 

-- 
Iker Arizmendi
AT&T Labs - Research
Speech and Image Processing Lab
e: iker at research.att.com
w: http://research.att.com




More information about the Mod_python mailing list