Re: Any example of Server/Client Side Sorting?

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

Sorry, there's a typo in there:

cmp=lambda x,y: cmp(x[0].lower(), y[0}.lower())
 ^
Should be ]

Ciao, Michael.

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Python-LDAP-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


Re: Any example of Server/Client Side Sorting?

2009-05-15 Thread Zhang Huangbin
Michael Ströder wrote:
>
> Sorry, there's a typo in there:
>
> cmp=lambda x,y: cmp(x[0].lower(), y[0}.lower())
>  ^
> Should be ]


I found that before, but got the same error:

 >>> alist
[('[email protected],o=domainAdmins,dc=iredmail,dc=org', {'mail': 
['[email protected]'], 'accountStatus': ['active'], 'enabledService': 
['awstats'], 'domainGlobalAdmin': ['yes']}), 
('[email protected],o=domainAdmins,dc=iredmail,dc=org', {'mail': 
['[email protected]'], 'accountStatus': ['active'], 'domainGlobalAdmin': 
['yes']}), ('[email protected],o=domainAdmins,dc=iredmail,dc=org', {'mail': 
['[email protected]'], 'accountStatus': ['active'], 'domainGlobalAdmin': 
['no']}), ('[email protected],o=domainAdmins,dc=iredmail,dc=org', {'mail': 
['[email protected]'], 'accountStatus': ['active'], 'domainGlobalAdmin': ['no']})]

 >>> cmp=lambda x,y: cmp(x[0].lower(), y[0].lower())

 >>> alist.sort(cmp)
Traceback (most recent call last):
  File "", line 1, in ?
  File "", line 1, in 
  File "", line 1, in 
  File "", line 1, in 
  File "", line 1, in 
  File "", line 1, in 
  File "", line 1, in 
  File "", line 1, in 
  File "", line 1, in 
  .. SKIP MANY LINES HERE ..
  File "", line 1, in 
  File "", line 1, in 
  File "", line 1, in 
  File "", line 1, in 
RuntimeError: maximum recursion depth exceeded

-- 
Best regards.

Zhang Huangbin

- Open Source Mail Server Solution for RHEL, CentOS, Debian:
  http://code.google.com/p/iredmail/


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Python-LDAP-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


Re: Any example of Server/Client Side Sorting?

2009-05-15 Thread Michael Ströder
Zhang Huangbin wrote:
>  >>> cmp=lambda x,y: cmp(x[0].lower(), y[0].lower())
> 
>  >>> alist.sort(cmp)

Ouch! One should probably not mask the standard function name cmp.
So try this:

mycmp=lambda x,y: cmp(x[0].lower(), y[0].lower())
alist.sort(mycmp)

Ciao, Michael.

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Python-LDAP-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


Re: Any example of Server/Client Side Sorting?

2009-05-15 Thread Zhang Huangbin
Michael Ströder wrote:
> mycmp=lambda x,y: cmp(x[0].lower(), y[0].lower())
> alist.sort(mycmp)

I found this and solved too.
Big thanks :)


-- 
Best regards.

Zhang Huangbin

- Open Source Mail Server Solution for RHEL, CentOS, Debian:
  http://code.google.com/p/iredmail/


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Python-LDAP-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev