[Zope] Syntax

Michael Gutmann gutmann@uni-duesseldorf.de
Thu, 12 Jul 2001 14:59:02 +0200


Hello there,

Paul Zwarts wrote:

> Hi Benoit,
> 
> AFAIK, the _ is used as a hack.
> 
> _ actually is the namespace variable, but in this case:
> 
>   REQUEST['var']   and    _[REQUEST['var']]

 > is no different. You use the _['something'] construction when a dash is used
 > in the name:

well, I am by no means a great zopemaster, but in my understanding this is
_NOT_ the same. _ gives you access to the global namespace, that means to
every variable that is defined at the moment you call it. Lets say, you have a form,
where var is filled with 'foo', then (after submitting, certainly ;-)
REQUEST['var'] gives 'foo'. _['var'] gives the same result, when there
is no other variable named 'var' in your global namespace (f.e. a property
somewhere, but here I may miss).
BUT: _[REQUEST['var']] is the same as _['foo'] and would look
for a variable named 'foo'.

> Did I miss anything, oh great zopemasters?

Yes, son! :-))

> Cheers,
> Paz

happy zoping,
Michael

-- 
Michael Gutmann M.A.
gutmann@uni-duesseldorf.de
Multimediazentrum Heinrich-Heine-Universitaet Duesseldorf