[mod_python] namespace available to psp

David Bear David.Bear at asu.edu
Thu May 18 17:31:32 EDT 2006


this is it. yes. I was not passing vars when I called the psp.

On Thu, May 18, 2006 at 12:19:24PM -0400, Jim Gallacher wrote:
> David Bear wrote:
> >When using psp called from publisher, what is the namespace shared
> >between the instance of publisher and the called psp?
> >
> >I modelled a test of the templating example from modpython.org. 
> >
> >I have a function call _any_page that is called to setup any/all
> >objects passed to a psp page.
> >
> >in that function I have 
> >
> >vars = {"mytest": "this is  atest"}
> >
> >then, in my psp page I have
> >
> ><%= mytest %>
> >
> >When run, ie. when called from the publisher script I get a Namerror
> >exception -- that mytest is not defined.
> >
> >so then I tried
> >
> ><%= locals() %> in the psp page and looked at the namespace. I didn't
> >see any of the vars defined in the publisher script.
> >
> 
> You are passing in vars in the PSP() constructor or in the run() method, 
> right?
> 
> tmpl = psp.PSP(req, filename=filename, vars=vars)
> or
> tmpl.run(vars)
> 
> Jim
> 

-- 
David Bear
phone: 	480-965-8257
fax: 	480-965-9189
College of Public Programs/ASU
Wilson Hall 232
Tempe, AZ 85287-0803
 "Beware the IP portfolio, everyone will be suspect of trespassing"


More information about the Mod_python mailing list