Any example of Server/Client Side Sorting?

2009-05-14 Thread Zhang Huangbin
Hi, all. Does anyone has working code snippet of server/client side sorting? I use serverctrls in search_ext_s() like this: search_ext_s(, serverctrls = [ ldap.controls.LDAPControl('1.2.840.113556.1.4.473',1,None) ],) got error msg: UNAVAILABLE_CRITICAL_EXTENSION: {'info': 'critical e

Re: Any example of Server/Client Side Sorting?

2009-05-14 Thread Michael Ströder
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(, serverctrls = [ > ldap.controls.LDAPControl('1.2.840.113556.1.4.473',1,None) ],) > > got error msg: > > UNAVAILABLE_CRITI

Re: Any example of Server/Client Side Sorting?

2009-05-14 Thread Zhang Huangbin
Michael Ströder wrote: > > The error message is pretty clear: This particular LDAP server does not > support server-side sorting. > I checked the rootdse, neither server side sort nor client side sort is supported: supportedControl: 2.16.840.1.113730.3.4.18 supportedControl: 2.16.840.1.1

Re: Any example of Server/Client Side Sorting?

2009-05-14 Thread Michael Ströder
Zhang Huangbin wrote: > Michael Ströder wrote: >> The error message is pretty clear: This particular LDAP server does not >> support server-side sorting. > > I checked the rootdse, neither server side sort nor client side sort is > supported: 1. Client-side sorting is done within the client libs

Re: Any example of Server/Client Side Sorting?

2009-05-14 Thread Zhang Huangbin
Michael Ströder wrote: > > 1. Client-side sorting is done within the client libs if supported. So > it wouldn't be listed in the attribute 'supportedControl' of the DSA's > rootDSE anyway. Not sure whether client controls are used in OpenLDAP's > libldap at all. > Any exist python module/functi

Re: Any example of Server/Client Side Sorting?

2009-05-14 Thread Michael Ströder
Zhang Huangbin wrote: > Michael Ströder wrote: >> 1. Client-side sorting is done within the client libs if supported. So >> it wouldn't be listed in the attribute 'supportedControl' of the DSA's >> rootDSE anyway. Not sure whether client controls are used in OpenLDAP's >> libldap at all. > > Any e

Re: Any example of Server/Client Side Sorting?

2009-05-14 Thread Zhang Huangbin
Michael Ströder wrote: > Zhang Huangbin wrote: > >> Any exist python module/function to sort ldap search results? > > Well, why do you really need that? I don't have client-side sorting in > web2ldap because it won't scale with large search results. Some of my > customers have more than 100k per

Re: Any example of Server/Client Side Sorting?

2009-05-14 Thread Michael Ströder
Zhang Huangbin wrote: > Michael Ströder wrote: >> Zhang Huangbin wrote: >> >>> Any exist python module/function to sort ldap search results? >> Well, why do you really need that? I don't have client-side sorting in >> web2ldap because it won't scale with large search results. Some of my >> custo

Re: Any example of Server/Client Side Sorting?

2009-05-14 Thread Zhang Huangbin
Michael Ströder wrote: > > 100+ entries are not so many. So you could try sorting the list of > search results retrieved with LDAPObject.ldap_search_ext_s() by invoking > list method .sort(). Make sure you understand how to control the > comparisons. > > See item 8. here: > http://docs.python.org/l

Re: Any example of Server/Client Side Sorting?

2009-05-14 Thread Michael Ströder
Zhang Huangbin wrote: > Michael Ströder wrote: >> 100+ entries are not so many. So you could try sorting the list of >> search results retrieved with LDAPObject.ldap_search_ext_s() by invoking >> list method .sort(). Make sure you understand how to control the >> comparisons. >> >> See item 8. here

Re: Any example of Server/Client Side Sorting?

2009-05-14 Thread Russell Jackson
Michael Ströder wrote: > Zhang Huangbin wrote: >> Michael Ströder wrote: >> Tring to learn ldap programing from web2ldap now. Thanks for your great >> program. :) > > Bear in mind that I started learning Python when the first code was > written almost 11 years ago. So I have to admit that many par

Re: Any example of Server/Client Side Sorting?

2009-05-14 Thread Zhang Huangbin
Michael Ströder wrote: > > Compare function for case-insensitive comparison of the DN: > > cmp=lambda x,y: cmp(x[0].lower(), y[0}.lower()) > > Thanks Michael. :) I tried this compare function, but got this err msg: RuntimeError: maximum recursion depth exceeded The result contains