Ticket #7269: debug.py.2.diff

File debug.py.2.diff, 1.4 KB (added by Carl Karsten <carl@…>, 16 years ago)

now works for include(foo.urls) urls too.

  • views/debug.py

     
    178178        if not tried:
    179179            # tried exists but is an empty list. The URLconf must've been empty.
    180180            return empty_urlconf(request)
     181    urlpatterns = [(t,t.strip('^$').replace(' ','')) for t in tried]
    181182
    182183    t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 template')
    183184    c = Context({
    184185        'root_urlconf': settings.ROOT_URLCONF,
    185186        'request_path': request.path[1:], # Trim leading slash
    186         'urlpatterns': tried,
     187        'urlpatterns': urlpatterns,
    187188        'reason': str(exception),
    188189        'request': request,
    189190        'request_protocol': request.is_secure() and "https" or "http",
     
    696697      Django tried these URL patterns, in this order:
    697698      </p>
    698699      <ol>
    699         {% for pattern in urlpatterns %}
    700           <li>{{ pattern }}</li>
     700        {% for pattern,guess in urlpatterns %}
     701          <li><a href="/{{ guess }}">{{ pattern }}</a</li>
    701702        {% endfor %}
    702703      </ol>
    703       <p>The current URL, <code>{{ request_path|escape }}</code>, didn't match any of these.</p>
     704      <p>The current URL, "<code>{{ request_path|escape }}</code>", didn't match any of these.</p>
    704705    {% else %}
    705706      <p>{{ reason }}</p>
    706707    {% endif %}
Back to Top