Modify

Opened 12 years ago

Closed 12 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

Description

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/main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/path/to/trac/web/main.py", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "/path/to/trac/admin/web_ui.py", line 125, in process_request
    path_info)
  File "/path/to/tracworkflowadmin/web_ui.py", line 106, in render_admin_panel
    self._parse_request(req)
  File "/path/to/tracworkflowadmin/web_ui.py", line 657, in _parse_request
    self._update_diagram(req, params) # not return
  File "/path/to/tracworkflowadmin/web_ui.py", line 404, in _update_diagram
    _, errors = self._validate_workflow(req, params)
  File "/path/to/tracworkflowadmin/web_ui.py", 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/web_ui.py

     
    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 12 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

Change Properties
Set your email in Preferences
Action
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.