Edgewall Software

Opened 3 years ago

Last modified 3 years ago

#13176 closed defect

Skip custom field of type select with no options — at Version 1

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: low Milestone: 1.0.18
Component: ticket system Version:
Severity: normal Keywords: ticket-custom
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

Ticket custom field with no options is created as an empty select:

select1 = select

I found strange behavior resulted in ticket validation when testing #13040. A warning would be raised when cloning a ticket, but not when creating a new ticket.

I think it would be better to just skip creation of ticket custom field of type select when it has no options.

  • trac/ticket/api.py

    diff --git a/trac/ticket/api.py b/trac/ticket/api.py
    index 9a752c32f..4c29f7c80 100644
    a b class TicketSystem(Component):  
    379379            }
    380380            if field['type'] == 'select' or field['type'] == 'radio':
    381381                field['options'] = config.getlist(name + '.options', sep='|')
     382                if not field['options']:
     383                    continue
    382384                if '' in field['options']:
    383385                    field['optional'] = True
    384386                    field['options'].remove('')

The built-in ticket fields already have this behavior.

Change History (2)

by Ryan J Ollos, 3 years ago

comment:1 by Ryan J Ollos, 3 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.