Modify

Opened 12 years ago

Closed 9 years ago

#10586 closed defect (fixed)

Sorting in unicode

Reported by: klaux1@… Owned by: Ryan J Ollos
Priority: normal Component: UserManagerPlugin
Severity: normal Keywords:
Cc: Steffen Hoffmann 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@… 12 years ago.

Download all attachments as: .zip

Change History (6)

Changed 12 years ago by klaux1@…

Attachment: admin_um.patch added

comment:1 in reply to:  description Changed 12 years ago by Ryan J Ollos

Cc: Steffen Hoffmann added; klaux1@… removed
Owner: changed from Catalin BALAN to Ryan J Ollos
Status: newassigned

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 12 years ago by Ryan J Ollos

(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 12 years ago by Ryan J Ollos

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

comment:4 Changed 12 years ago by Ryan J Ollos

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

comment:5 Changed 9 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.