Ticket #10523 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

leaving blank display names gives malformed labels

Reported by: gary.martin@wandisco.com Assigned to: jun66j5
Priority: normal Component: TracWorkflowAdminPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

This is more of a problem for pasted workflows in text mode as the gui encourages a display name to be edited from an initial "Action name" but you are also allowed to remove that name. On saving this currently results in entries of the form

action.name =

in the [ticket-workflow] section of the trac.ini and this results in malformed labels on tickets.

This could be considered Trac's fault for not noticing that the entries are blank but something like the following would be one way of solving the problem here (just skips output of {{{action.name}} entries without values).

Index: tracworkflowadmin/web_ui.py
===================================================================
--- tracworkflowadmin/web_ui.py	(revision 12234)
+++ tracworkflowadmin/web_ui.py	(working copy)
@@ -627,8 +627,9 @@
                 for (name, value) in self.config.options('ticket-workflow'):
                     self.config.remove('ticket-workflow', name)
                 out['result'] = 0
-                for key in newOptions.keys():
-                    self.config.set('ticket-workflow', key, newOptions[key])
+                [self.config.set('ticket-workflow', key, opt) 
+                    for key, opt in newOptions.iteritems() 
+                    if not(key.endswith('.name') and not opt)]
                 self.config.save()
             except Exception, e:
                 self.config.parse_if_needed(force=True)

Attachments

Change History

10/22/12 15:35:35 changed by jun66j5

  • status changed from new to closed.
  • resolution set to fixed.

(In [12237]) tracworkflowadmin: fixed blank display for the action in ticket page if action.name is blank

Report and initial patch by Gary Martin, Thanks. Closes #10523.


Add/Change #10523 (leaving blank display names gives malformed labels)




Change Properties
Action