[Zope] LDAP KeyError problem

Michael Blewett michael.blewett@sci.monash.edu.au
Tue, 07 Nov 2000 17:20:16 +1100


Hi Everyone,

We have a problem with the LDAP Adapter. I've searched the entire Zope Doc 
website and thru the mailing list archives and can't find any examples of 
anything that come remotely close.
If we define an LDAP filter (called Academics) as thus:

Base DN: o=Monash University, c=au

and search filter as:
(&(ou=Department of Biological 
Sciences)(employeetype=Full-time)(employeetype=Academic Staff))

..it gives me a perfect list of all my LDAP entries for all of my full-time 
academic staff. i can see all of the attributes perfectly when I click the 
Test tab.
No problems there.



However, when I try to use some of the entries in a dtml-in statement, half 
of the entries give me a KeyError.

for eg.

<dtml-var standard_html_header>
<h2><dtml-var title_or_id></h2>
<p>

<dtml-in Academics>
    Surname:   <dtml-var sn><BR>
    Given Name: <dtml-var givenname><BR>
    Initials: <dtml-var initials><BR>
    Gender:      <dtml-var gender><BR>
    Phone: <dtml-var phonenumber><BR><BR>
</dtml-in Academics>

</p>
<dtml-var standard_html_footer>


If I try to view the above document, it gives me a KeyError on phonenumber.
ie
Zope Error

Zope has encountered an error while publishing this resource.

Error Type: KeyError
Error Value: phonenumber

<snip>

Traceback (innermost last):
   File /usr/Zope/lib/python/ZPublisher/Publish.py, line 222, in publish_module
   File /usr/Zope/lib/python/ZPublisher/Publish.py, line 187, in publish
   File /usr/Zope/lib/python/Zope/__init__.py, line 221, in 
zpublisher_exception_hook
     (Object: Traversable)
   File /usr/Zope/lib/python/ZPublisher/Publish.py, line 171, in publish
   File /usr/Zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
     (Object: index_html)
   File /usr/Zope/lib/python/ZPublisher/Publish.py, line 112, in call_object
     (Object: index_html)
   File /usr/Zope/lib/python/OFS/DTMLDocument.py, line 177, in __call__
     (Object: index_html)
   File /usr/Zope/lib/python/DocumentTemplate/DT_String.py, line 528, in 
__call__
     (Object: index_html)
   File /usr/Zope/lib/python/DocumentTemplate/DT_In.py, line 691, in renderwob
     (Object: Academics)
KeyError: (see above)



If I remove that line, it works perfectly.

the same thing happens on a number of other attributes including title, 
roomnumber, mail, facsimiletelephonenumber  (all the ones I want/need 
really...).


Can anybody give me any clues what I'm doing wrong here? Has anybody hit 
this problem before?

We are using Zope 2.2.2, Python version: 1.5.2, and ZopeLDAP 1.0beta1

Any help greatly appreciated....


  - Michael

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Michael Blewett
Computer Support Mgr - Biological Sciences
Monash University (Clayton Campus)
Victoria Australia 3168

"I'm out of my mind at the moment, but feel free to leave a message..."