[Zope-dev] Want to test if User Equal to a Property
Jason Spisak
webmaster@mtear.com
Thu, 18 Mar 1999 15:09:46 -0500
Yes Gabe, my dents are healing now. To evaluate the page based on login
I use this code:
<!--#if expr=_['owner']==AUTHENTICATED_USER.getUserName()"-->
<!--#var foo-->
<!--#else-->
<!--#var bar-->
<!--#/if-->
Provided the parent folder or any aquirable folder has a property named
'owner' which stands for the peron you want to "own" the document, it
will evaluate just fine.
Hope that helps,
Jason Spisak
webmaster@mtear.com
Gabe Wachob wrote:
>
> Has this been figured out? I had the *exact* same question and have severe
> dents on my forehead from banging my head into my monitor trying to figure
> this out..
>
> -Gabe
>
> "Shaw, Howard" wrote:
>
> > I would expect that you need the single quotes. When you say _[object]
> > you are looking up the result of object. That is, if object is a
> > property containing the string 'test' then _[object] is identical to
> > _['test']. If you have a property "object" containing the string 'owner'
> > then you need to use _['object'] to evaluate to 'owner'. That is,
> > _['object']=='owner', while _[object]==_['owner'].
> >
> > Good luck.
> > ----------
> > From: Jason Spisak [SMTP:webmaster@mtear.com]
> > Sent: Friday, March 12, 1999 7:21 AM
> > To: zope-dev@zope.org
> > Subject: [Zope-dev] Want to test if User Equal to a Property
> >
> > Zopsters,
> >
> > I am attempting to tailor the way information gets viewed based
> > on a
> > person's login. When the user get's to the page described by
> > the
> > following code, I would like the page to look one way if the
> > 'owner'
> > property in the parent folder is equal to the user, and look the
> > other
> > way if they are not equal. The following code makes sense, but
> > does not
> > work.
> >
> > <!--#var standard_html_header-->
> > <!--#if expr="AUTHENTICATED_USER.getUserName()==_[owner]"-->
> > <!--#var candidate_edit-->
> > <!--#else-->
> > <!--#var candidate_noedit-->
> > <!--#/if-->
> > <!--#var standard_html_footer-->
> >
> > The _[owner] property is stored as a string. And
> > AUTHERNTICAED_USER.getUserName() returns a string if I'm not
> > mistaken.
> > The look-up for _[owner] without single quotes is because I'm
> > not
> > looking up an object, but a property, right? The document is a
> > DTML
> > Method. Do I have to reference the Parent in the lookup?
> >
> > All the best,
> >
> >
--
Jason Spisak
webmaster@mtear.com