Any example of Server/Client Side Sorting?

Michael Ströder michael at stroeder.com
Thu May 14 11:46:28 CEST 2009


Zhang Huangbin wrote:
> 
> Does anyone has working code snippet of server/client side sorting?
> 
> I use serverctrls in search_ext_s() like this:
> 
>   search_ext_s(xxxx, serverctrls = [ 
> ldap.controls.LDAPControl('1.2.840.113556.1.4.473',1,None) ],)
> 
> got error msg:
> 
>   UNAVAILABLE_CRITICAL_EXTENSION: {'info': 'critical extension is not 
> recognized', 'desc': 'Critical extension is unavailable'}
> 
> * Use clientctrls:
> 
>   search_ext_s(xxxx, clientctrls = [ 
> ldap.controls.LDAPControl('1.2.840.113556.1.4.473',1,None) ],)
> 
> got error msg:
> 
>   NOT_SUPPORTED: {'info': '', 'desc': 'Not Supported'}
> 
> My os is Ubuntu 9.04, OpenLDAP-2.4.15-1ubuntu3.

The error message is pretty clear: This particular LDAP server does not
support server-side sorting.

Besides that you should read RFC 2891 to learn how to generate the
controlValue which specifies which attribute and matching rule
(optional) is used for sorting and whether you want reverse order
(optional). You could try to generate the controlValue with module pyasn1.

Ciao, Michael.



More information about the python-ldap mailing list