Edgewall Software

Opened 18 years ago

Closed 11 years ago

#924 closed defect (fixed)

[PATCH] Value of custom checkbox fields are not displayed properly

Reported by: pkou <pkou at ua.fm> Owned by: Christian Boos
Priority: normal Milestone: 0.11
Component: ticket system Version: devel
Severity: minor Keywords: custom fields
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


Custom fields with checkbox type are not displayed properly on ticket summary screen:

  • When the value of a checkbox is OFF, nothing is displayed;
  • When the value of a checkbox is ON, 1 is displayed.

Attached patch fixes the defect by displaying No and Yes appropriately.

Attachments (1)

patch-customcbshow-r1049.diff (664 bytes ) - added by pkou <pkou at ua.fm> 18 years ago.
Patch for the defect

Download all attachments as: .zip

Change History (10)

by pkou <pkou at ua.fm>, 18 years ago

Patch for the defect

comment:1 by sid, 15 years ago

See also #2306.

comment:2 by Christian Boos, 15 years ago

Keywords: custom fields added
Milestone: 1.0
Severity: trivialminor

comment:3 by sid, 15 years ago

#2306 was marked as duplicate of this ticket. It also has a patch.

comment:4 by Christian Boos, 15 years ago

Milestone: 1.00.11
Owner: changed from Jonas Borgström to Christian Boos

This is fixed in the FieldRefactoring branch (check the notifications though).

comment:5 by Christian Boos, 15 years ago

Resolution: fixed
Status: newclosed

Implemented in r5812, r5813.

comment:6 by anonymous, 11 years ago

This fix is completely stupid.

I just defined some checkbox fields in Trac. I updated some tickets with values for these checkboxes. Then I noticed, lo and behold, they display as "yes" or "no", and not checkboxes.

This is not the object I defined. I defined a checkbox, damn it! So, by golly, I want to see a checkbox.

The checkboxes represent approval for an item. A clear checkbox means "abstained from approving". But "no" strongly suggests "disapproved".

comment:7 by anonymous, 11 years ago

Resolution: fixed
Status: closedreopened

comment:8 by anonymous, 11 years ago

I am not able to fix it. The following patch escapes my HTML. Unicode also doesn't work, because some object complains about non-ASCII bytes in the stream:

--- pyshared.orig/trac/ticket/web_ui.py 2011-09-16 11:59:40.000000000 -0700
+++ pyshared/trac/ticket/web_ui.py      2011-09-16 12:04:59.000000000 -0700
@@ -1120,7 +1120,7 @@
             elif type_ == 'checkbox':
                 value = ticket.values.get(name)
                 if value in ('1', '0'):
-                    field['rendered'] = value == '1' and _('yes') or _('no')
+                    field['rendered'] = value == '1' and '&#x2713;' or ''

             # ensure sane defaults
             field.setdefault('optional', False)

The quick and dirty idea was just to render a Unicode checkmark, or leave it blank.

How can I express to the Python code that I would like raw HTML?

I don't want to learn the entire internals of Trac just to solve this. (I have only about 30 more minutes in total that I can spend on this issue, unfortunately.)

comment:9 by Remy Blank, 11 years ago

Resolution: fixed
Status: reopenedclosed

Reopening a 7 year old ticket fixed 4 years ago and complaining loudly won't get you anywhere. If you want something changed, please open a new enhancement request and describe in an appropriate language what you want and why it's better than the current state.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.