[Zope] Logic-defying bug with LDAP method

Phillip J. Eby pje@telecommunity.com
Thu, 03 Feb 2000 07:10:37 -0500


At 08:16 PM 2/2/00 -0600, Dennis Moore wrote:
>I've got an LDAP method called 'getuser' which simply returns all the
>information for a particular userid.  This part seems to work ok.  I am
>having a really weird problem with trying to use the information I get from
>it, though:
>
><dtml-call "REQUEST.set('userid', 'someone')">
>
><dtml-in getuser>
><dtml-call "REQUEST.set('foo', departmentnumber)">
></dtml-in>
>
><dtml-if  "foo == 'RU168'">
>	match!
><dtml-else>
>	foo .<dtml-var foo>.
><p><dtml-var REQUEST>
></dtml-if>
>
>This prints:
>foo .RU168.
>
>So foo is RU168, but the conditional still fails for some reason.  Now, if
>I do virtually the same thing with an SQL method, it works fine (prints
>"match!").  I can get the results, print them, and compare them.  The weird
>behavior only happens with the data from an LDAP method.

If "departmentnumber" is an LDAP field, it's actually a list.  That is,
it's a sequence that contains one string, not a string itself.  Try:

<dtml-call "REQUEST.set('foo', departmentnumber[0])">