Opened 8 years ago
Last modified 8 years ago
#12604 closed defect
Ticket() with invalid ticket id should raise ResourceNotFound rather than ValueError — at Initial Version
Reported by: | Jun Omae | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.14 |
Component: | ticket system | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
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'
Note:
See TracTickets
for help on using tickets.