Modify ↓
Opened 12 years ago
Closed 12 years ago
#10493 closed defect (fixed)
actions without operations cause errors in text mode
Reported by: | 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
511 511 if len(errors) == 0: 512 512 leave_status_exists = False 513 513 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'] == '*': 515 516 leave_status_exists = True 516 517 break 517 518 if not leave_status_exists:
Attachments (0)
Note: See
TracTickets for help on using
tickets.
(In [12193]) tracworkflowadmin: fixed errors caused by actions without
.operations
in text mode (fixed #10493)Report and initial patch by Gary Martin. Thanks.