Opened 4 years ago

Closed 4 years ago

#10493 closed defect (fixed)

actions without operations cause errors in text mode

Reported by: gary.martin@… Owned by: Jun Omae
Priority: normal Component: TracWorkflowAdminPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12


I was testing with the text mode and the opensource workflow from trac's contrib workflows and I noticed errors of the form

2012-10-17 17:38:35,718 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "/path/to/trac/web/", line 497, in _dispatch_request
  File "/path/to/trac/web/", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "/path/to/trac/admin/", line 125, in process_request
  File "/path/to/tracworkflowadmin/", line 106, in render_admin_panel
  File "/path/to/tracworkflowadmin/", line 657, in _parse_request
    self._update_diagram(req, params) # not return
  File "/path/to/tracworkflowadmin/", line 404, in _update_diagram
    _, errors = self._validate_workflow(req, params)
  File "/path/to/tracworkflowadmin/", line 514, in _validate_workflow
    if 'leave_status' in act['operations'] and act['next'] == '*':
KeyError: 'operations'

It would appear that trac is happy for some actions to lack an operation and so I suggest something equivalent to the following:

  • tracworkflowadmin/

    511511        if len(errors) == 0:
    512512            leave_status_exists = False
    513513            for act in params['actions']:
    514                 if 'leave_status' in act['operations'] and act['next'] == '*':
     514                if 'leave_status' in act.get('operations',[]) \
     515                        and act['next'] == '*':
    515516                    leave_status_exists = True
    516517                    break
    517518            if not leave_status_exists:

Attachments (0)

Change History (1)

comment:1 Changed 4 years ago by Jun Omae

Resolution: fixed
Status: newclosed

(In [12193]) tracworkflowadmin: fixed errors caused by actions without .operations in text mode (fixed #10493)

Report and initial patch by Gary Martin. Thanks.

Modify Ticket

as closed The owner will remain Jun Omae.
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.