Edgewall Software

Opened 9 years ago

Last modified 5 years ago

#11828 closed enhancement

Replace underscores with whitespace when creating action label from action name — at Initial Version

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.3
Component: ticket system Version:
Severity: normal Keywords: workflow
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Consider a workflow action such as the following:

may_reassign = new,assigned,accepted,reopened -> assigned
may_reassign.operations = may_set_owner
may_reassign.permissions = TICKET_MODIFY 
may_reassign.set_owner =

If I want the action name to look nice, I must add another attribute:

may_reassign.name = may reassign

What would be the downside to doing a simple replacement?

  • trac/ticket/default_workflow.py

    diff --git a/trac/ticket/default_workflow.py b/trac/ticket/default_workflow.py
    index f9c595e..f35ca4f 100644
    a b def parse_workflow_config(rawactions):  
    6767    for action, attributes in actions.items():
    6868        # Default the 'name' attribute to the name used in the ini file
    6969        if 'name' not in attributes:
    70             attributes['name'] = action
     70            attributes['name'] = action.replace("_", " ")
    7171        # If not specified, an action is not the default.
    7272        attributes['default'] = int(attributes.get('default', 0))
    7373        # If operations are not specified, that means no operations

The only downside I can think of is when the user really wants an underscore in the name, but I guess that to be a rather infrequent occurrence.

The same replacement could be applied to TracTicketsCustomFields field name.

Speaking of which, it's a bit confusing that the attribute label is used for TracTicketsCustomFields, whereas name is used for TracWorkflow, considering the attribute do the same thing.

Anyway, those are just small things and not too important.

Change History (0)

Note: See TracTickets for help on using tickets.