Ticket #7269: debug.py.3.diff

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

added "Note:...not always usable..."

  • 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('^$')) 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 %}
     
    710711    <p>
    711712      You're seeing this error because you have <code>DEBUG = True</code> in
    712713      your Django settings file. Change that to <code>False</code>, and Django
    713       will display a standard 404 page.
     714      will display your custom 404 page.
    714715    </p>
     716    <br>
     717    <p>
     718      Note: The above links are formed using .strip('^$').replace(' ','')
     719      This does not always result in a usable link,
     720      but when it does, it is handy. 
     721      <!-- With enough work it might be posible to craft valid URLs.
     722      feel free to do the work and submit it. -->
     723    </p>
     724
    715725  </div>
    716726</body>
    717727</html>
Back to Top