[Zope] DTML namespace from Python Script

Terry Hancock hancock@anansispaceworks.com
Sun, 24 Mar 2002 17:52:06 -0800


I could've sworn I saw the answer to this at one point, but now
I can't find it:

How can I access the "_" namespace in a Python Script?

E.g., within a DTML Method I can use "_.SecurityGetUser()" to
get the current authenticated user, but I've tried a lot of
different versions in a Python Script and none of them seems
to work:

SecurityGetUser()
_.SecurityGetUser()
context.SecurityGetUser()

and so on. It seems to me that I *ought* to be able to use the
same calling convention in either DTML Python expressions or
within a Python script.  Curiously the first choice above would
seem to be implied by the use of Python "builtins" such as
"int()", which is refered to as "_.int()" within DTML.  But I've
tried it -- it doesn't work here, I just get an attribute error.

It's this kind of "except on Tuesday" design that really
frustrates me about Zope, in case any developers are tuned
in!  I could go on, but it would just be a rant.

Anyone know the arcane incantation I'm supposed to use for
this? Any pointers appreciated!

Thanks!
Terry

-- 
------------------------------------------------------
Terry Hancock
hancock@anansispaceworks.com       
Anansi Spaceworks                 
http://www.anansispaceworks.com 
P.O. Box 60583                     
Pasadena, CA 91116-6583
------------------------------------------------------