Using SQLite I want have proper alphabetical sorting for the users language
at the database level (from ORDER BY).
My question is:
1) is there a way to get this behaviour ?
2) if not, can it be achieved with code bellow without modifying the Web2py
framework ?
3) if not (if it will require Web2py framework change), what is the best
way how to implement this (or..can it implement somebody from core
developers) ?
I have tested that collating/compare function can be set for SQLite so:
import locale
locale.setlocale(locale.LC_ALL, 'cs_CZ.utf8')
db = DAL('sqlite://db.sqlite')
db._adapter.connection.create_collation("lexical", locale.strcoll)
and then the raw sql command:
db.executesql('SELECT nick FROM auth_user ORDER BY nick COLLATE lexical;')
return records in correct alphabetical order for given language.
So, so far we need no change in the framework.
In SQLFORM.Grid works
orderby=db.auth_user.nick
and
orderby='auth_user.nick'
too.
But with hack like
orderby='auth_user.nick COLLATE lexical'
I was not successfull.
--
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.