[prev in list] [next in list] [prev in thread] [next in thread]
List: zope
Subject: Re: [Zope] newbie Q. DTML syntax
From: Nick Garcia <ngarcia () codeit ! com>
Date: 2000-05-31 21:22:03
[Download RAW message or body]
Brad Moulton wrote:
>
> As a newbie i have tried a few variations on the following
> but the <dtml-if> never returns true
>
> <dtml-in "PARENTS[0].objectValues(['customer'])" sort=lname>
> <dtml-if "(_['sequence-item'].title == AUTHENTICATED_USER)">
> <tr><td>customer </td><td><dtml-var accno></td>
> .......and other values from "customers" folder with meta type customer
> </dtml-if>
> </dtml-in>
>
> I have previously modified an add_instance method to store
> AUTHENTICATED_USER as the "title"
> viewing the folder shows this to be so.
> If I display these values they appear the same. I just do not know the
> correct syntax inside <dtml-if>
You actually have the syntax correct, you're just comparing apples to
oranges. AUTHENTICATED_USER is an object, that when called just happens
to return a string. Your if statement above is comparing the string
attribute title to the object AUTHENTICATED_USER, which is why it's
always returning false. The correct comparison above would be:
<dtml-if "(_['sequence-item'].title ==
AUTHENTICATED_USER.getUserName())">
The getUserName function of the AUTHENTICATED_USER object returns a
string containing the username.
--
Nick Garcia | ngarcia@codeit.com
CodeIt Computing | http://codeit.com
_______________________________________________
Zope maillist - Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope-dev )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic