Modify ↓
#12881 closed defect (fixed)
TypeError is raised caused by post_process_request in batch.py when no resolutions
| Reported by: | Jun Omae | Owned by: | Ryan J Ollos |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.0.17 |
| Component: | ticket system | Version: | 1.0.14 |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: |
Fix exception in |
||
| API Changes: | |||
| Internal Changes: | |||
Description
How to reproduce
- Create an environemnt.
- Remove all resolutions.
- Create an new ticket.
- View /query?id=1 by a user granted TRAC_ADMIN.
TypeErroris raised.
07:59:43 PM Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/query?id=1'">
07:59:43 PM Trac[session] DEBUG: Retrieving session for ID u'admin'
07:59:43 PM Trac[main] DEBUG: Negotiated locale: en_US -> en_US
07:59:43 PM Trac[api] WARNING: Unable to find repository '(default)' for synchronization
07:59:43 PM Trac[chrome] DEBUG: Prepare chrome data for request
07:59:43 PM Trac[query] DEBUG: Count results in Query: 1
07:59:43 PM Trac[default_workflow] DEBUG: render_ticket_action_control: action "leave"
07:59:43 PM Trac[default_workflow] DEBUG: render_ticket_action_control: action "resolve"
07:59:43 PM Trac[main] ERROR: Exception caught while post-processing request:
Traceback (most recent call last):
File "/venv/trac/1.0.15/lib/python2.5/site-packages/trac/web/main.py", line 279, in dispatch
self._post_process_request(req)
File "/venv/trac/1.0.15/lib/python2.5/site-packages/trac/web/main.py", line 403, in _post_process_request
f.post_process_request(req, *(None,)*extra_arg_count)
File "/venv/trac/1.0.15/lib/python2.5/site-packages/trac/ticket/batch.py", line 80, in post_process_request
self.add_template_data(req, data, data['tickets'])
TypeError: 'NoneType' object is unsubscriptable
07:59:43 PM Trac[main] WARNING: [192.168.11.25] HTTPInternalError: 500 Trac Error (Your workflow attempts to set a resolution but none is defined (configuration issue, please contact your Trac admin).), <RequestWithSession "GET '/query?id=1'">, referrer None
192.168.11.25 - - [07/Aug/2017 19:59:43] "GET /trac-1.0/query?id=1 HTTP/1.1" 500 -
It seems this issue is introduced in [15154] (#12591).
The following patch is to check whether template and data in post_process_request() are not None. Those variable would be None when an exception while invoking process_request() is raised.
-
trac/ticket/batch.py
diff --git a/trac/ticket/batch.py b/trac/ticket/batch.py index 2be5f0485..8a129c920 100644
a b class BatchModifyModule(Component): 75 75 return handler 76 76 77 77 def post_process_request(self, req, template, data, content_type): 78 if req.path_info == '/query' and \ 78 if template and data is not None and \ 79 req.path_info == '/query' and \ 79 80 'TICKET_BATCH_MODIFY' in req.perm('ticket'): 80 81 self.add_template_data(req, data, data['tickets']) 81 82 return template, data, content_type
Attachments (0)
Change History (3)
comment:1 by , 8 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:2 by , 8 years ago
| Release Notes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.



Thanks for catching my error. I will add a test before committing.