[Zope] Do All Classes Have Default Current Objects?

Dan Shafer dan@gui.com
Mon, 15 Oct 2001 10:06:26 -0700


I was rummaging about in Zope last night trying to figure out how I 
could find out the user name of the current user. Turns out, of 
course, to be pretty easy.

But I would never have thought of it without the HowTo's help. I had 
tried using AuthenticedUser.getUserName() without success but when I 
changed to use the apparently automatically defined 
AUTHENTICATED_USER object, it worked.

So two questions.

1. Do all of the Zope Classes have an equivalent object that I should 
use when I want to invoke their methods on the current instance? Or 
is this true only of objects passed via the REQUEST?

2. Is this fact -- or anything else about these globals -- documented 
anywhere? I looked through the Zope Book, ZQR, HowTos and Tips to no 
avail. I also searched the online help. I did find a _reference_ to 
AUTHENTICATED_USER and to REQUEST.AUTHENTICATED_USER in a function 
called SecurityGetUser() but no real information on the use of the 
AuthenticatedUser class itself.


-- 
Learn to absorb information, internalize new ideas, and generate 
creative solutions three times faster, triple guaranteed!
Ask me about Acccelerated Learning Plus! Free introductory lesson.
dan@gui.com - 831-643-0590 (Voice) - 831-401-2531 (Fax)