Ticket #11990: technical_404_urlconf.patch

File technical_404_urlconf.patch, 1.3 KB (added by mattbennett, 15 years ago)
  • django/views/debug.py

    ### Eclipse Workspace Patch 1.0
    #P djangotrunk
     
    22import re
    33import sys
    44import datetime
     5import types
    56
    67from django.conf import settings
    78from django.template import Template, Context, TemplateDoesNotExist
     
    252253            # tried exists but is an empty list. The URLconf must've been empty.
    253254            return empty_urlconf(request)
    254255
     256    urlconf = getattr(request,'urlconf',settings.ROOT_URLCONF)
     257    if isinstance(urlconf, types.ModuleType):
     258        urlconf = request.urlconf.__name__
     259
    255260    t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 template')
    256261    c = Context({
    257         'root_urlconf': settings.ROOT_URLCONF,
     262        'urlconf': urlconf,
    258263        'request_path': request.path_info[1:], # Trim leading slash
    259264        'urlpatterns': tried,
    260265        'reason': smart_str(exception, errors='replace'),
     
    746751  <div id="info">
    747752    {% if urlpatterns %}
    748753      <p>
    749       Using the URLconf defined in <code>{{ settings.ROOT_URLCONF }}</code>,
     754      Using the URLconf defined in <code>{{ urlconf }}</code>,
    750755      Django tried these URL patterns, in this order:
    751756      </p>
    752757      <ol>
Back to Top