Opened 10 years ago
Closed 9 years ago
#12076 closed defect (fixed)
resource_exists in trac.ticket.api should avoid database exceptions from invalid input
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.7 |
Component: | ticket system | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Tracebacks in log are avoided with PostgreSQL when navigating to the URL |
||
API Changes: |
Exceptions are trapped and |
||
Internal Changes: |
Description (last modified by )
Reported in th:#12253, the function resource_exists
in trac.ticket.api
raises an exception on PostgreSQL when resource.id
is not an integer.
Perhaps we should simply try converting resource.id
to an integer in resource_exists:
try: id_ = int(resource.id) except ValueError: return False
Attachments (0)
Change History (5)
comment:1 by , 10 years ago
Description: | modified (diff) |
---|---|
Owner: | set to |
Status: | new → assigned |
follow-up: 3 comment:2 by , 10 years ago
comment:3 by , 10 years ago
Replying to jomae:
I think we should catch both
TypeError
andValueError
.
Thanks. Proposed changes in log:rjollos.git:t12076-resource-exists-trap-exception.
comment:5 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I think we should catch both
TypeError
andValueError
.