Modify

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#11708 closed defect (fixed)

[Patch] Unicode field names in SQLTable macro

Reported by: theYT <dev@…> Owned by: Ryan J Ollos
Priority: normal Component: WikiTableMacro
Severity: normal Keywords: unicode
Cc: Trac Release: 1.0

Description

Error occured when using non-ASCII text as field name (as table header). Values are ok.

Sample:

SELECT 'test' as '한글'

Patch file attached. (tested with r13683)

Attachments (1)

table.py.patch (515 bytes) - added by theYT <dev@…> 10 years ago.

Download all attachments as: .zip

Change History (8)

Changed 10 years ago by theYT <dev@…>

Attachment: table.py.patch added

comment:1 Changed 10 years ago by Jun Omae

No. to_unicode() is not needed. We should use get_column_names() instead of cursor.description directly.

comment:2 Changed 10 years ago by Ryan J Ollos

Thanks for the feedback. I'll apply a patch that uses get_column_names.

comment:3 Changed 9 years ago by Ryan J Ollos

Status: newaccepted

comment:4 Changed 9 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 14524:

0.3dev: Use Trac 1.0 DB API.

  • Macro now requires Trac 1.0 and later.
  • Genshi is used to construct the table.
  • Queries can use non-ASCII table names. Fixes #11708.
  • Read-only database connection is used.

Please report any issues with the latest changes.

comment:5 Changed 9 years ago by theYT <dev@…>

Checked with [14524]:

  • Trac 1.1.4 database API changes: OK
  • non-ASCII Table names: OK
  • SQLTable macro error (MySQL DB): ticket #12269
  • Now Wiki text field displayed as one-line (format_to_htmlformat_to_oneliner); I don't know which one would be better...

comment:6 in reply to:  5 Changed 9 years ago by Ryan J Ollos

Replying to theYT <dev@…>:

  • Now Wiki text field displayed as one-line (format_to_htmlformat_to_oneliner); I don't know which one would be better...

Thank you for reviewing and testing. It seems either format_to_html or format_to_oneliner might be preferred depending on the data being returned.

I made the change to oneliner to avoid the margins on the paragraph, however format_to_html could be used with some CSS to remove the margins (similar to [14529]). Another option would be to support an argument for the WikiProcessor to specify paragraph or oneliner.

comment:7 Changed 9 years ago by Ryan J Ollos

In 14734:

0.3dev: Partial revert of [14524]. Refs #11708.

Reverts to format_to_html but adds CSS to shrink the cell margins.

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.