I want to sort the results of a select() based on a string field. Normally
I can just use select(orderby=db.mytable.myfield), but the strings are not
in Latin characters, so the default string sorting produces unacceptable
results.
I've figured out how to create a comparison function using the PyICU
bindings to the ICU library. In a regular list sort this allows me to do
something like this:
from icu import Locale, Collator
myloc = Locale('el')
col = Collator.createInstance(myloc)
words = ['ἀγ', 'βλα', 'ὁμηρ']
sorted_words = sorted(words, cmp=col.compare)
Is there any way to pass this kind of custom collating function to the
select()?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.