Iker Arizmendi
iker at research.att.com
Thu Aug 19 21:23:13 EDT 2004
What I meant is that I'd like to have the req object globally available within the module as it is within PSP pages. Any way to do that? Robert Geller wrote: > As for NameError: global name 'req' is not defined, > > You must put req as an argument to the function test, i.e. > > def test(req): > req.write("this is a test") > > Robert Geller > robert at worksofmagic.com > > > > -----Original Message----- > From: mod_python-bounces at modpython.org > [mailto:mod_python-bounces at modpython.org] On Behalf Of Iker Arizmendi > Sent: Thursday, August 19, 2004 6:44 PM > To: mod_python user mailing list > Subject: [mod_python] from mod_python import apache > > > Hello all, > > I have a PSP page, say test.psp, that does an import > of a module called mymod.py. In this module I have > something like the following > > from mod_python import apache > > def test(): > req.write("this is a test") > > My test.psp page imports this module and tries > to invoke the test() method, but I get the > following error: > > NameError: global name 'req' is not defined > > I've tried various combinations of import statements > in mymod.py with no luck. How can I make the req > object available to the module? I've verified that > the its available to test.psp, but when the PSP page > calls the module - boom. > > Here's my Apache config as well: > > Listen 80 > NameVirtualHost *:80 > <VirtualHost *:80> > <Directory "/home/iker/www/"> > AddHandler mod_python .psp > PythonHandler mod_python.psp > PythonDebug On > PythonPath "['/path/to/mymodule/'] + sys.path" > Options FollowSymLinks +Indexes > AllowOverride All > Order allow,deny > Allow from all > </Directory> > ServerName rose > ServerAlias localhost > DocumentRoot /home/iker/www/ > LogLevel debug > </VirtualHost> > > > Thanks, > Iker > > > -- Iker Arizmendi AT&T Labs - Research Speech and Image Processing Lab e: iker at research.att.com w: http://research.att.com
|