Schema-API

Jens Vagelpohl jens at zope.com
Wed Aug 7 23:14:36 CEST 2002


here's the traceback::

[dhcp182:src/python-ldap-HEAD/Demo] jens% python2.1 schema.py 
ldap://waldorf.zope.com/dc=vts,dc=zope,dc=com
Time elapsed search sub schema sub entry: 0.018
Traceback (most recent call last):
   File "schema.py", line 29, in ?
     subschemasubentry_entry = l.read_subschemasubentry_s(
   File "/usr/local/lib/python2.1/site-packages/ldap/ldapobject.py", line 
584, in read_subschemasubentry_s
     attrs
   File "/usr/local/lib/python2.1/site-packages/ldap/ldapobject.py", line 
422, in search_s
     return self.search_st(base,scope,filterstr,attrlist,attrsonly,timeout=
-1)
   File "/usr/local/lib/python2.1/site-packages/ldap/ldapobject.py", line 
425, in search_st
     msgid = self.search(base,scope,filterstr,attrlist,attrsonly)
   File "/usr/local/lib/python2.1/site-packages/ldap/ldapobject.py", line 
419, in search
     return 
self._ldap_call(self._l.search,base,scope,filterstr,attrlist,attrsonly)
   File "/usr/local/lib/python2.1/site-packages/ldap/ldapobject.py", line 
95, in _ldap_call
     result = apply(func,args,kwargs)
TypeError: argument 1 must be string, not None
[dhcp182:src/python-ldap-HEAD/Demo] jens%

the "error" is that this call on ldapobject.py line 557 "e = 
ldap.cidict.cidict(r[0][1])" all of a sudden lowercases the key 
"subschemaSubentry" from the original search result. so when the code 
tries to determine the value of that key, and asks for the *camelcased* 
version, it will get None back: "e.get('subschemaSubentry',[None])[0]" 
because "e" only has a key "subschemasubentry". if "e" contains the 
original camelcased key then the script continues successfully.

jens




On Wednesday, August 7, 2002, at 04:03 , Michael Ströder wrote:

> Jens Vagelpohl wrote:
>> i'm trying to run the Demo/schema.py script and steppping through it 
>> with pdb there's an oddity i see, which prevents the script from running 
>> successfully:
>> - ldapobject.py line 548 (in method search_subschemasubentry) a search 
>> is done on the passed-in DN to retrieve the value for the attribute 
>> "subschemaSubentry". the search is successful and returns...
>> [('dc=vts,dc=zope,dc=com', {'subschemaSubentry': ['cn=Subschema']})]
>> - in line 555 there is the following call:
>> e = ldap.cidict.cidict(r[0][1])  (r is the result shown above)
>> - at this point "e" has the following value:
>> {'subschemasubentry': ['cn=Subschema']}  (notice: "subschemasubentry" is 
>> all lowercase now)
>> - now the problem is in line 556 in the call...
>> search_subschemasubentry_dn = e.get('subschemaSubentry', [None])[]
>
> Yes, no problem since ldap.cidict.cidict is used. I wouldn't claim that 
> there is no bug. But I can't see a problem.
>
>> ... at this point the result is None and the script dies a little later.
>
> "Dies a little later" is a little bit unspecific. Can you please provide 
> the traceback and mention which LDAP server you're using for testing?
>
> Ciao, Michael.
>






More information about the python-ldap mailing list