Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#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


Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/trac/web/", line 514, in send_error
    data, 'text/html')
  File "/usr/lib/python2.7/site-packages/trac/web/", line 983, in render_template
    stream |= self._filter_stream(req, method, filename, stream, data)
  File "/usr/lib64/python2.7/site-packages/genshi/", line 133, in __or__
    return Stream(_ensure(function(self)), serializer=self.serializer)
  File "/usr/lib/python2.7/site-packages/trac/web/", line 1162, in inner
  File "build/bdist.linux-x86_64/egg/breadcrumbsnav/", line 184, in filter_stream
    title = get_resource_summary(self.env, resource)
  File "/usr/lib/python2.7/site-packages/trac/", line 347, in get_resource_summary
    return get_resource_description(env, resource, 'summary')
  File "/usr/lib/python2.7/site-packages/trac/", line 333, in get_resource_description
    return manager.get_resource_description(resource, format, **kwargs)
  File "/usr/lib/python2.7/site-packages/trac/ticket/", line 525, in get_resource_description
    ticket = Ticket(self.env,
  File "/usr/lib/python2.7/site-packages/trac/ticket/", line 82, in __init__
  File "/usr/lib/python2.7/site-packages/trac/ticket/", line 121, in _fetch_ticket
    id=tkt_id), _("Invalid ticket number"))
ResourceNotFound: Ticket 1899 does not exist.

My raw fix

  • breadcrumbsnav/

    1010from trac.config import IntOption, ListOption, Option
    1111from trac.env import IEnvironmentSetupParticipant
    1212from trac.resource import Resource, get_resource_shortname, \
    13                           get_resource_summary
     13                          get_resource_summary, ResourceNotFound
    1414from trac.web import IRequestFilter
    1515from trac.web.api import ITemplateStreamFilter
    1616from import ITemplateProvider, add_stylesheet
    181181            resource = Resource(realm, resource_id)
    183183            name = get_resource_shortname(self.env, resource)
    184             title = get_resource_summary(self.env, resource)
    185             link = req.href(realm, resource_id)
     185            try:
     186                title = get_resource_summary(self.env, resource)
     187            except ResourceNotFound:
     188                title = "Deleted"
     189                pass
     191            link = req.href(realm, resource_id)
    187193            first = ul == []
    188194            li =, href=link)(name))
    189195            if first:

Attachments (0)

Change History (3)

comment:1 Changed 3 years ago by Ryan J Ollos

Owner: set to Ryan J Ollos
Status: newaccepted

comment:2 Changed 3 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 16589:

BreadCrumbsNav 0.3: Don't display non-existent resources

Based on a patch by ntmlod

Require Trac >= 1.0 and conform to PEP8.

Fixes #13178.

comment:3 Changed 3 years ago by Ryan J Ollos

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!

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.