Modify ↓
Opened 9 years ago
Closed 9 years ago
#12604 closed defect (fixed)
Ticket() with invalid ticket id should raise ResourceNotFound rather than ValueError
| Reported by: | Jun Omae | Owned by: | Jun Omae |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.0.14 |
| Component: | ticket system | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: |
Raise |
||
| API Changes: | |||
| Internal Changes: | |||
Description
I got the following error in my production environment. It seems the user try to use ticket.get('id') via JSON-RPC.
2016-08-25 09:04:09,725 (7f0946c09700) ERROR: RPC(JSON-RPC) Error
Traceback (most recent call last):
File "/vol/releases/20160818034305/share/plugins/TracXMLRPC.egg/tracrpc/web_ui.py", line 155, in _rpc_process
result = (XMLRPCSystem(self.env).get_method(method_name)(req, args))[0]
File "/vol/releases/20160818034305/share/plugins/TracXMLRPC.egg/tracrpc/api.py", line 209, in __call__
result = self.callable(req, *args)
File "/vol/releases/20160818034305/share/plugins/TracXMLRPC.egg/tracrpc/ticket.py", line 158, in get
t = model.Ticket(self.env, id)
File "/usr/local/tracfarm/lib/python2.6/site-packages/trac/ticket/model.py", line 69, in __init__
tkt_id = int(tkt_id)
ServiceException: invalid literal for int() with base 10: 'id'
I consider Ticket() passed invalid ticket id should raise ResourceNotFound rather than ValueError.
>>> from trac.test import EnvironmentStub >>> from trac.ticket.model import Ticket >>> env = EnvironmentStub() >>> t = Ticket(env, 'id') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/venv/trac/1.0.13/lib/python2.5/site-packages/trac/ticket/model.py", line 69, in __init__ tkt_id = int(tkt_id) ValueError: invalid literal for int() with base 10: 'id'
Attachments (0)
Change History (3)
comment:1 by , 9 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:3 by , 9 years ago
| Release Notes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Thanks for the reviewing. Committed in [15172] and merged in [15173-15174].
Note:
See TracTickets
for help on using tickets.



Proposed changes in [96864b590/jomae.git] (jomae.git@t12604).
After the changes: