Ticket #10586 (assigned defect)

Opened 7 months ago

Last modified 7 months ago

Sorting in unicode

Reported by: klaux1@yahoo.com.br Assigned to: rjollos (accepted)
Priority: normal Component: UserManagerPlugin
Severity: normal Keywords:
Cc: hasienda Trac Release:

Description

Dear Friends!

I make the diff modification in template.

Now the sorting is made by the name column. But in pt_BR or pt_BR.UTF-8 the accented characters are on the list bottom.

Usuário    | Nome             | Email                   | Role
ZA\asdqwe  | Amanda qwe qwe   | amanda@qwe.com.br       | Analista de Qualidade 	
TT\qweqwe  | Bruno qwe qwe    | bruno@qwe.com.br        | Analista de Qualidade 	
TJ\qweqwe  | Ivan qwe asd     | ivan@qwe.com.br         | integrador
AS\asdasd  | Vinicius asd qwe | vmsoares@qwe.com.br     | gestor
AV\asdqwe  | Ítalo qwe zxc    | italoantonio@qwe.com.br	| integrador             <<< 	

Thx.

--
KlauX

Attachments

admin_um.patch (1.0 kB) - added by klaux1@yahoo.com.br on 10/31/12 12:06:44.

Change History

10/31/12 12:06:44 changed by klaux1@yahoo.com.br

  • attachment admin_um.patch added.

(in reply to: ↑ description ) 11/02/12 03:46:34 changed by rjollos

  • status changed from new to assigned.
  • cc changed from klaux1@yahoo.com.br to hasienda.
  • owner changed from cbalan to rjollos.

Replying to klaux1@yahoo.com.br:

I make the diff modification in template.

What Trac version are you running? Do you have Babel installed and the language set?

Now the sorting is made by the name column.

I prepared a change that I'll commit shortly, which enables sorting for each of the columns. Please let me know if that satisfies your need. I felt it was a more general solution than the patch you proposed.

But in pt_BR or pt_BR.UTF-8 the accented characters are on the list bottom.

There is a suggestion here to use locale.strxfrm() or locale.strcoll(). I tried searching around the Trac core for examples, and I don't see any instances of sorting in the template for a case in which the sort function would need to know the language. In the Trac core, the sorting appears to be handled at the database layer. For example, when sorting a custom report by a column, the sort action results in a database query with the ORDER BY parameter specified. Per my testing, the sorting does happen property when the language has been set in the user preference (I tested with ticket summaries in Russian), so the proper sorting per the locale must be happening in the database backend.

It seems we could implement the sorting at the DB layer here as well, but we'd have to modify the API so that UserManager.get_active_users and UserManager.search would take a sortby parameter ... or so it appears to me on initial inspection.

11/02/12 22:14:07 changed by rjollos

(In [12286]) Refs #10586:

  • Columns can be sorted on the Users page.
    • Changes are Python 2.4 compatible by choosing and/or clauses in favor of if/else, but code can be refactored and made cleaner in a future revision when the 2.4 compatibility is dropped.
    • The implementation of the query module (primarily query.html, query_results.html, query.py) was used as a guide.
  • Bumped version to 0.5dev.
  • Added a changelog.

11/02/12 22:17:03 changed by rjollos

Testing feedback, code review and any other comments are welcome and appreciated.

11/03/12 22:04:20 changed by rjollos

(In [12293]) Refs #10586: Part of [12286]. Removed unused variable.


Add/Change #10586 (Sorting in unicode)




Change Properties
Action