~ubuntu-branches/ubuntu/quantal/python-django/quantal

« back to all changes in this revision

Viewing changes to django/views/debug.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2009-07-29 11:26:28 UTC
  • mfrom: (1.1.8 upstream) (4.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20090729112628-pg09ino8sz0sj21t
Tags: 1.1-1
* New upstream release.
* Merge from experimental:
  - Ship FastCGI initscript and /etc/default file in python-django's examples
    directory (Closes: #538863)
  - Drop "05_10539-sphinx06-compatibility.diff"; it has been applied
    upstream.
  - Bump Standards-Version to 3.8.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
from django.conf import settings
7
7
from django.template import Template, Context, TemplateDoesNotExist
8
8
from django.utils.html import escape
 
9
from django.utils.importlib import import_module
9
10
from django.http import HttpResponse, HttpResponseServerError, HttpResponseNotFound
10
11
from django.utils.encoding import smart_unicode, smart_str
11
12
 
67
68
            self.loader_debug_info = []
68
69
            for loader in template_source_loaders:
69
70
                try:
70
 
                    source_list_func = getattr(__import__(loader.__module__, {}, {}, ['get_template_sources']), 'get_template_sources')
 
71
                    module = import_module(loader.__module__)
 
72
                    source_list_func = module.get_template_sources
71
73
                    # NOTE: This assumes exc_value is the name of the template that
72
74
                    # the loader attempted to load.
73
75
                    template_list = [{'name': t, 'exists': os.path.exists(t)} \
99
101
            'frames': frames,
100
102
            'lastframe': frames[-1],
101
103
            'request': self.request,
102
 
            'request_protocol': self.request.is_secure() and "https" or "http",
103
104
            'settings': get_safe_settings(),
104
105
            'sys_executable': sys.executable,
105
106
            'sys_version_info': '%d.%d.%d' % sys.version_info[0:3],
258
259
        'urlpatterns': tried,
259
260
        'reason': smart_str(exception, errors='replace'),
260
261
        'request': request,
261
 
        'request_protocol': request.is_secure() and "https" or "http",
262
262
        'settings': get_safe_settings(),
263
263
    })
264
264
    return HttpResponseNotFound(t.render(c), mimetype='text/html')
397
397
    </tr>
398
398
    <tr>
399
399
      <th>Request URL:</th>
400
 
      <td>{{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path_info|escape }}</td>
 
400
      <td>{{ request.build_absolute_uri|escape }}</td>
401
401
    </tr>
402
402
    <tr>
403
403
      <th>Exception Type:</th>
405
405
    </tr>
406
406
    <tr>
407
407
      <th>Exception Value:</th>
408
 
      <td><pre>{{ exception_value|escape }}<pre></td>
 
408
      <td><pre>{{ exception_value|escape }}</pre></td>
409
409
    </tr>
410
410
    <tr>
411
411
      <th>Exception Location:</th>
527
527
Environment:
528
528
 
529
529
Request Method: {{ request.META.REQUEST_METHOD }}
530
 
Request URL: {{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path_info|escape }}
 
530
Request URL: {{ request.build_absolute_uri|escape }}
531
531
Django Version: {{ django_version_info }}
532
532
Python Version: {{ sys_version_info }}
533
533
Installed Applications:
609
609
  {% else %}
610
610
    <p>No POST data</p>
611
611
  {% endif %}
 
612
  <h3 id="files-info">FILES</h3>
 
613
  {% if request.FILES %}
 
614
    <table class="req">
 
615
        <thead>
 
616
            <tr>
 
617
                <th>Variable</th>
 
618
                <th>Value</th>
 
619
            </tr>
 
620
        </thead>
 
621
        <tbody>
 
622
            {% for var in request.FILES.items %}
 
623
                <tr>
 
624
                    <td>{{ var.0 }}</td>
 
625
                    <td class="code"><div>{{ var.1|pprint }}</div></td>
 
626
                </tr>
 
627
            {% endfor %}
 
628
        </tbody>
 
629
    </table>
 
630
  {% else %}
 
631
    <p>No FILES data</p>
 
632
  {% endif %}
 
633
 
612
634
 
613
635
  <h3 id="cookie-info">COOKIES</h3>
614
636
  {% if request.COOKIES %}
717
739
      </tr>
718
740
      <tr>
719
741
        <th>Request URL:</th>
720
 
      <td>{{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path_info|escape }}</td>
 
742
      <td>{{ request.build_absolute_uri|escape }}</td>
721
743
      </tr>
722
744
    </table>
723
745
  </div>