Re: [web2py] Re: web2py postgres sort by

2014-11-05 Thread Yebach
Since I cannot change the db settings is there a way to order my list 
inside web2py? 



On Tuesday, November 4, 2014 10:19:51 AM UTC+1, Michele Comitini wrote:

 Just to be sure try the _select:

 print db(db.teachers.t_name!='None')._select(db.teachers.t_name, 
 orderby=db.teachers.t_name, distinct=True)

 You will should see same result using the resulting statement under psql.

 Now the problem seems your database.  The collation is wrong, since it's 
 for US:
  LC_COLLATE = 'en_US.UTF-8'
  LC_CTYPE = 'en_US.UTF-8'

 Install proper locales for slovenian restart postgres and create a new 
 database with proper collations.
 See on postgresql.org how to do it.

 mic


 2014-11-04 9:56 GMT+01:00 Niphlod nip...@gmail.com javascript::

 this is more suited to a postgresql forum than a web2py's one


 On Tuesday, November 4, 2014 8:52:54 AM UTC+1, Yebach wrote:

 Hello

 I have a postgres db with encoding and collation settings

 CREATE DATABASE algit_osnovna_sola
   WITH OWNER = postgres
ENCODING = 'UTF8'
TABLESPACE = pg_default
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
CONNECTION LIMIT = -1;

 When I use select with order by I do not get the right sort order for 
 Slovenian language. It is not completely off, but for some letters they are 
 treated as the same
 My select 

 teacher_list=db(db.teachers.t_name!='None').select(db.teachers.t_name, 
 orderby=db.teachers.t_name, distinct=True).as_list()

 my result 

 [{'t_name': 'BABI\xc4\x8c Biljana'}, {'t_name': 'BARBO Sre\xc4\x8dko'}, 
 {'t_name': 'BARUCA Ingrid'}, {'t_name': 'CERKVENIK Karmen'}, {'t_name': 
 'DANI\xc4\x8cI\xc4\x8c Vu\xc4\x8dko'}, {'t_name': '\xc4\x90OROVI\xc4\x86 
 Aleksandar'}, {'t_name': 'FALKNER Anja'}, {'t_name': 
 'FLORJAN\xc4\x8cI\xc4\x8c Andrej'}, {'t_name': 'GAZI\xc4\x8c Mojca'}, 
 {'t_name': 'GORJAN Melina'}, {'t_name': 'GRLJ Vilko'}, {'t_name': 'HARCET 
 Franjo'}, {'t_name': 'HRE\xc5\xa0\xc4\x8cAK Erika'}, {'t_name': 'JAHN 
 Marjan'}, {'t_name': 'JELEN Branko'}, {'t_name': 'JEREBICA Nevenka'}, 
 {'t_name': 'JERMAN Nata\xc5\xa1a'}, {'t_name': 'KING Mojca'}, {'t_name': 
 'KOCJAN\xc4\x8cI\xc4\x8c Dolores'}, {'t_name': 'KOCJAN\xc4\x8cI\xc4\x8c 
 Nevio'}, {'t_name': 'KORO\xc5\xa0EC Erika'}, {'t_name': 'KOZJAK Igor'}, 
 {'t_name': 'KRAJNC Elvira'}, {'t_name': 'KRT Sini\xc5\xa1a'}, {'t_name': 
 'KUZMAN Franjo'}, {'t_name': 'LEDINEK Bianka'}, {'t_name': 'LENASSI 
 Andreja'}, {'t_name': 'MARA\xc5\xbd Jelica'}, {'t_name': 'MAVRI\xc4\x8c 
 Barbara'}, {'t_name': 'MEJAK Giliola'}, {'t_name': 'MESARI\xc4\x8c Alen'}, 
 {'t_name': 'MIKOLAV\xc4\x8cI\xc4\x8c Mitja'}, {'t_name': 'MUNIH Marko'}, 
 {'t_name': 'NOVOSELEC Katarina'}, {'t_name': 'PAULI\xc4\x8c Simona'}, 
 {'t_name': 'PE\xc4\x8cAR BOLE Bojana'}, {'t_name': 'PLAZNIK Jadran'}, 
 {'t_name': 'PODGORNIK Marko'}, {'t_name': 'POHLEN Doris'}, {'t_name': 
 'POKLAR Branko'}, {'t_name': 'PREGELJC Damjana'}, {'t_name': 'RUDL Ensi'}, 
 {'t_name': '\xc5\xa0AV Angel'}, {'t_name': '\xc5\xa0IRCELJ Du\xc5\xa1an'}, 
 {'t_name': '\xc5\xa0KERJANC Marko'}, {'t_name': 'SLAVEC Marija'}, 
 {'t_name': '\xc5\xa0TEMBERGER Samo'}, {'t_name': 'TRAJBAR Mitja'}, 
 {'t_name': 'UMER Jo\xc5\xbea'}, {'t_name': 'URANJEK Damjan'}, {'t_name': 
 'VALENTI\xc4\x8c Maja'}, {'t_name': 'VERGAN Helena'}, {'t_name': 'VOUK 
 Renato'}, {'t_name': 'ZAVRTANIK Boris'}, {'t_name': '\xc5\xbdNIDARI\xc4\x8c 
 Maja'}, {'t_name': 'ZRINSKI Elen'}]

 The problem is  for example with {'t_name': '\xc5\xa0AV Angel'}, 
 {'t_name': '\xc5\xa0IRCELJ Du\xc5\xa1an'}, {'t_name': '\xc5\xa0KERJANC 
 Marko'}, {'t_name': 'SLAVEC Marija'}, {'t_name': '\xc5\xa0TEMBERGER Samo'}

 Where 'SLAVEC Marija should be the first one followd by '\xc5\xa0 names

 any suggestions?

 In my db.py I set encoding to utf-8 but that does not help.

 thank you







  -- 
 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 web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: web2py postgres sort by

2014-11-05 Thread Johann Spies
In the PostgreSQL documentation I see

 The LC_COLLATE and LC_CTYPE settings are determined when a database is
created, and cannot be changed except by creating a new database. Other
locale settings including LC_MESSAGES and LC_MONETARY are initially
determined by the environment the server is started in, but can be changed
on-the-fly. You can check the active locale settings using the SHOW
command.

I suspect you can do not much more  except create a new database with the
same data and correct encoding.

Regards
Johann


-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py postgres sort by

2014-11-04 Thread Niphlod
this is more suited to a postgresql forum than a web2py's one

On Tuesday, November 4, 2014 8:52:54 AM UTC+1, Yebach wrote:

 Hello

 I have a postgres db with encoding and collation settings

 CREATE DATABASE algit_osnovna_sola
   WITH OWNER = postgres
ENCODING = 'UTF8'
TABLESPACE = pg_default
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
CONNECTION LIMIT = -1;

 When I use select with order by I do not get the right sort order for 
 Slovenian language. It is not completely off, but for some letters they are 
 treated as the same
 My select 

 teacher_list=db(db.teachers.t_name!='None').select(db.teachers.t_name, 
 orderby=db.teachers.t_name, distinct=True).as_list()

 my result 

 [{'t_name': 'BABI\xc4\x8c Biljana'}, {'t_name': 'BARBO Sre\xc4\x8dko'}, 
 {'t_name': 'BARUCA Ingrid'}, {'t_name': 'CERKVENIK Karmen'}, {'t_name': 
 'DANI\xc4\x8cI\xc4\x8c Vu\xc4\x8dko'}, {'t_name': '\xc4\x90OROVI\xc4\x86 
 Aleksandar'}, {'t_name': 'FALKNER Anja'}, {'t_name': 
 'FLORJAN\xc4\x8cI\xc4\x8c Andrej'}, {'t_name': 'GAZI\xc4\x8c Mojca'}, 
 {'t_name': 'GORJAN Melina'}, {'t_name': 'GRLJ Vilko'}, {'t_name': 'HARCET 
 Franjo'}, {'t_name': 'HRE\xc5\xa0\xc4\x8cAK Erika'}, {'t_name': 'JAHN 
 Marjan'}, {'t_name': 'JELEN Branko'}, {'t_name': 'JEREBICA Nevenka'}, 
 {'t_name': 'JERMAN Nata\xc5\xa1a'}, {'t_name': 'KING Mojca'}, {'t_name': 
 'KOCJAN\xc4\x8cI\xc4\x8c Dolores'}, {'t_name': 'KOCJAN\xc4\x8cI\xc4\x8c 
 Nevio'}, {'t_name': 'KORO\xc5\xa0EC Erika'}, {'t_name': 'KOZJAK Igor'}, 
 {'t_name': 'KRAJNC Elvira'}, {'t_name': 'KRT Sini\xc5\xa1a'}, {'t_name': 
 'KUZMAN Franjo'}, {'t_name': 'LEDINEK Bianka'}, {'t_name': 'LENASSI 
 Andreja'}, {'t_name': 'MARA\xc5\xbd Jelica'}, {'t_name': 'MAVRI\xc4\x8c 
 Barbara'}, {'t_name': 'MEJAK Giliola'}, {'t_name': 'MESARI\xc4\x8c Alen'}, 
 {'t_name': 'MIKOLAV\xc4\x8cI\xc4\x8c Mitja'}, {'t_name': 'MUNIH Marko'}, 
 {'t_name': 'NOVOSELEC Katarina'}, {'t_name': 'PAULI\xc4\x8c Simona'}, 
 {'t_name': 'PE\xc4\x8cAR BOLE Bojana'}, {'t_name': 'PLAZNIK Jadran'}, 
 {'t_name': 'PODGORNIK Marko'}, {'t_name': 'POHLEN Doris'}, {'t_name': 
 'POKLAR Branko'}, {'t_name': 'PREGELJC Damjana'}, {'t_name': 'RUDL Ensi'}, 
 {'t_name': '\xc5\xa0AV Angel'}, {'t_name': '\xc5\xa0IRCELJ Du\xc5\xa1an'}, 
 {'t_name': '\xc5\xa0KERJANC Marko'}, {'t_name': 'SLAVEC Marija'}, 
 {'t_name': '\xc5\xa0TEMBERGER Samo'}, {'t_name': 'TRAJBAR Mitja'}, 
 {'t_name': 'UMER Jo\xc5\xbea'}, {'t_name': 'URANJEK Damjan'}, {'t_name': 
 'VALENTI\xc4\x8c Maja'}, {'t_name': 'VERGAN Helena'}, {'t_name': 'VOUK 
 Renato'}, {'t_name': 'ZAVRTANIK Boris'}, {'t_name': '\xc5\xbdNIDARI\xc4\x8c 
 Maja'}, {'t_name': 'ZRINSKI Elen'}]

 The problem is  for example with {'t_name': '\xc5\xa0AV Angel'}, 
 {'t_name': '\xc5\xa0IRCELJ Du\xc5\xa1an'}, {'t_name': '\xc5\xa0KERJANC 
 Marko'}, {'t_name': 'SLAVEC Marija'}, {'t_name': '\xc5\xa0TEMBERGER Samo'}

 Where 'SLAVEC Marija should be the first one followd by '\xc5\xa0 names

 any suggestions?

 In my db.py I set encoding to utf-8 but that does not help.

 thank you









-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: web2py postgres sort by

2014-11-04 Thread Michele Comitini
Just to be sure try the _select:

print db(db.teachers.t_name!='None')._select(db.teachers.t_name,
orderby=db.teachers.t_name, distinct=True)

You will should see same result using the resulting statement under psql.

Now the problem seems your database.  The collation is wrong, since it's
for US:
 LC_COLLATE = 'en_US.UTF-8'
 LC_CTYPE = 'en_US.UTF-8'

Install proper locales for slovenian restart postgres and create a new
database with proper collations.
See on postgresql.org how to do it.

mic


2014-11-04 9:56 GMT+01:00 Niphlod niph...@gmail.com:

 this is more suited to a postgresql forum than a web2py's one


 On Tuesday, November 4, 2014 8:52:54 AM UTC+1, Yebach wrote:

 Hello

 I have a postgres db with encoding and collation settings

 CREATE DATABASE algit_osnovna_sola
   WITH OWNER = postgres
ENCODING = 'UTF8'
TABLESPACE = pg_default
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
CONNECTION LIMIT = -1;

 When I use select with order by I do not get the right sort order for
 Slovenian language. It is not completely off, but for some letters they are
 treated as the same
 My select

 teacher_list=db(db.teachers.t_name!='None').select(db.teachers.t_name,
 orderby=db.teachers.t_name, distinct=True).as_list()

 my result

 [{'t_name': 'BABI\xc4\x8c Biljana'}, {'t_name': 'BARBO Sre\xc4\x8dko'},
 {'t_name': 'BARUCA Ingrid'}, {'t_name': 'CERKVENIK Karmen'}, {'t_name':
 'DANI\xc4\x8cI\xc4\x8c Vu\xc4\x8dko'}, {'t_name': '\xc4\x90OROVI\xc4\x86
 Aleksandar'}, {'t_name': 'FALKNER Anja'}, {'t_name':
 'FLORJAN\xc4\x8cI\xc4\x8c Andrej'}, {'t_name': 'GAZI\xc4\x8c Mojca'},
 {'t_name': 'GORJAN Melina'}, {'t_name': 'GRLJ Vilko'}, {'t_name': 'HARCET
 Franjo'}, {'t_name': 'HRE\xc5\xa0\xc4\x8cAK Erika'}, {'t_name': 'JAHN
 Marjan'}, {'t_name': 'JELEN Branko'}, {'t_name': 'JEREBICA Nevenka'},
 {'t_name': 'JERMAN Nata\xc5\xa1a'}, {'t_name': 'KING Mojca'}, {'t_name':
 'KOCJAN\xc4\x8cI\xc4\x8c Dolores'}, {'t_name': 'KOCJAN\xc4\x8cI\xc4\x8c
 Nevio'}, {'t_name': 'KORO\xc5\xa0EC Erika'}, {'t_name': 'KOZJAK Igor'},
 {'t_name': 'KRAJNC Elvira'}, {'t_name': 'KRT Sini\xc5\xa1a'}, {'t_name':
 'KUZMAN Franjo'}, {'t_name': 'LEDINEK Bianka'}, {'t_name': 'LENASSI
 Andreja'}, {'t_name': 'MARA\xc5\xbd Jelica'}, {'t_name': 'MAVRI\xc4\x8c
 Barbara'}, {'t_name': 'MEJAK Giliola'}, {'t_name': 'MESARI\xc4\x8c Alen'},
 {'t_name': 'MIKOLAV\xc4\x8cI\xc4\x8c Mitja'}, {'t_name': 'MUNIH Marko'},
 {'t_name': 'NOVOSELEC Katarina'}, {'t_name': 'PAULI\xc4\x8c Simona'},
 {'t_name': 'PE\xc4\x8cAR BOLE Bojana'}, {'t_name': 'PLAZNIK Jadran'},
 {'t_name': 'PODGORNIK Marko'}, {'t_name': 'POHLEN Doris'}, {'t_name':
 'POKLAR Branko'}, {'t_name': 'PREGELJC Damjana'}, {'t_name': 'RUDL Ensi'},
 {'t_name': '\xc5\xa0AV Angel'}, {'t_name': '\xc5\xa0IRCELJ Du\xc5\xa1an'},
 {'t_name': '\xc5\xa0KERJANC Marko'}, {'t_name': 'SLAVEC Marija'},
 {'t_name': '\xc5\xa0TEMBERGER Samo'}, {'t_name': 'TRAJBAR Mitja'},
 {'t_name': 'UMER Jo\xc5\xbea'}, {'t_name': 'URANJEK Damjan'}, {'t_name':
 'VALENTI\xc4\x8c Maja'}, {'t_name': 'VERGAN Helena'}, {'t_name': 'VOUK
 Renato'}, {'t_name': 'ZAVRTANIK Boris'}, {'t_name': '\xc5\xbdNIDARI\xc4\x8c
 Maja'}, {'t_name': 'ZRINSKI Elen'}]

 The problem is  for example with {'t_name': '\xc5\xa0AV Angel'},
 {'t_name': '\xc5\xa0IRCELJ Du\xc5\xa1an'}, {'t_name': '\xc5\xa0KERJANC
 Marko'}, {'t_name': 'SLAVEC Marija'}, {'t_name': '\xc5\xa0TEMBERGER Samo'}

 Where 'SLAVEC Marija should be the first one followd by '\xc5\xa0 names

 any suggestions?

 In my db.py I set encoding to utf-8 but that does not help.

 thank you







  --
 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 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.