Modify

Opened 2 years ago

Last modified 2 years ago

#10586 assigned defect

Sorting in unicode

Reported by: klaux1@… Owned by: rjollos
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 (1)

admin_um.patch (1.0 KB) - added by klaux1@… 2 years ago.

Download all attachments as: .zip

Change History (5)

Changed 2 years ago by klaux1@…

comment:1 in reply to: ↑ description Changed 2 years ago by rjollos

  • Cc hasienda added; klaux1@… removed
  • Owner changed from cbalan to rjollos
  • Status changed from new to assigned

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.

comment:2 Changed 2 years ago 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.

comment:3 Changed 2 years ago by rjollos

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

comment:4 Changed 2 years ago by rjollos

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

Add Comment

Modify Ticket

Action
as assigned .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.