Modify ↓
#13178 closed defect (fixed)
Crash for ResourceNotFound after ticket deletion
Reported by: | ntmlod | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | BreadCrumbsNavPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description
Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/trac/web/api.py", line 514, in send_error data, 'text/html') File "/usr/lib/python2.7/site-packages/trac/web/chrome.py", line 983, in render_template stream |= self._filter_stream(req, method, filename, stream, data) File "/usr/lib64/python2.7/site-packages/genshi/core.py", line 133, in __or__ return Stream(_ensure(function(self)), serializer=self.serializer) File "/usr/lib/python2.7/site-packages/trac/web/chrome.py", line 1162, in inner data) File "build/bdist.linux-x86_64/egg/breadcrumbsnav/breadcrumbs.py", line 184, in filter_stream title = get_resource_summary(self.env, resource) File "/usr/lib/python2.7/site-packages/trac/resource.py", line 347, in get_resource_summary return get_resource_description(env, resource, 'summary') File "/usr/lib/python2.7/site-packages/trac/resource.py", line 333, in get_resource_description return manager.get_resource_description(resource, format, **kwargs) File "/usr/lib/python2.7/site-packages/trac/ticket/api.py", line 525, in get_resource_description ticket = Ticket(self.env, resource.id) File "/usr/lib/python2.7/site-packages/trac/ticket/model.py", line 82, in __init__ self._fetch_ticket(tkt_id) File "/usr/lib/python2.7/site-packages/trac/ticket/model.py", line 121, in _fetch_ticket id=tkt_id), _("Invalid ticket number")) ResourceNotFound: Ticket 1899 does not exist.
My raw fix
-
breadcrumbsnav/breadcrumbs.py
10 10 from trac.config import IntOption, ListOption, Option 11 11 from trac.env import IEnvironmentSetupParticipant 12 12 from trac.resource import Resource, get_resource_shortname, \ 13 get_resource_summary 13 get_resource_summary, ResourceNotFound 14 14 from trac.web import IRequestFilter 15 15 from trac.web.api import ITemplateStreamFilter 16 16 from trac.web.chrome import ITemplateProvider, add_stylesheet … … 181 181 resource = Resource(realm, resource_id) 182 182 183 183 name = get_resource_shortname(self.env, resource) 184 title = get_resource_summary(self.env, resource)185 link = req.href(realm, resource_id)186 184 185 try: 186 title = get_resource_summary(self.env, resource) 187 except ResourceNotFound: 188 title = "Deleted" 189 pass 190 191 link = req.href(realm, resource_id) 192 187 193 first = ul == [] 188 194 li = tag.li(tag.a(title=title, href=link)(name)) 189 195 if first:
Attachments (0)
Change History (3)
comment:1 Changed 8 years ago by
Owner: | set to Ryan J Ollos |
---|---|
Status: | new → accepted |
comment:2 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
comment:3 Changed 8 years ago by
Since the Deleted doesn't provide any useful navigation, I thought it would be better to just skip missing resources. Let me know if you find any issues.
Thanks for the patch!
Note: See
TracTickets for help on using
tickets.
In 16589: