Index: django/views/debug.py
===================================================================
--- django/views/debug.py	(revision 15359)
+++ django/views/debug.py	(working copy)
@@ -82,7 +82,7 @@
     def get_traceback_html(self):
         "Return HTML code for traceback."
 
-        if issubclass(self.exc_type, TemplateDoesNotExist):
+        if self.exc_type and issubclass(self.exc_type, TemplateDoesNotExist):
             from django.template.loader import template_source_loaders
             self.template_does_not_exist = True
             self.loader_debug_info = []
@@ -111,11 +111,12 @@
 
         frames = self.get_traceback_frames()
         for i, frame in enumerate(frames):
-            frame['vars'] = [(k, force_escape(pprint(v))) for k, v in frame['vars']]
+            if 'vars' in frame:
+                frame['vars'] = [(k, force_escape(pprint(v))) for k, v in frame['vars']]
             frames[i] = frame
 
         unicode_hint = ''
-        if issubclass(self.exc_type, UnicodeError):
+        if self.exc_type and issubclass(self.exc_type, UnicodeError):
             start = getattr(self.exc_value, 'start', None)
             end = getattr(self.exc_value, 'end', None)
             if start is not None and end is not None:
@@ -125,11 +126,8 @@
         t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 template')
         c = Context({
             'is_email': self.is_email,
-            'exception_type': self.exc_type.__name__,
-            'exception_value': smart_unicode(self.exc_value, errors='replace'),
             'unicode_hint': unicode_hint,
             'frames': frames,
-            'lastframe': frames[-1],
             'request': self.request,
             'settings': get_safe_settings(),
             'sys_executable': sys.executable,
@@ -141,6 +139,13 @@
             'template_does_not_exist': self.template_does_not_exist,
             'loader_debug_info': self.loader_debug_info,
         })
+        # Check whether exception info is available
+        if self.exc_type:
+            c['exception_type'] = self.exc_type.__name__
+        if self.exc_value:
+            c['exception_value'] = smart_unicode(self.exc_value, errors='replace')
+        if frames:
+            c['lastframe'] = frames[-1],
         return t.render(c)
 
     def get_template_exception_info(self):
@@ -248,14 +253,6 @@
                 })
             tb = tb.tb_next
 
-        if not frames:
-            frames = [{
-                'filename': '&lt;unknown&gt;',
-                'function': '?',
-                'lineno': '?',
-                'context_line': '???',
-            }]
-
         return frames
 
     def format_exception(self):
@@ -317,7 +314,7 @@
 <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
   <meta name="robots" content="NONE,NOARCHIVE">
-  <title>{{ exception_type }} at {{ request.path_info|escape }}</title>
+  <title>{% if exception_type %}{{ exception_type }}{% else %}Report{% endif %}{% if request %} at {{ request.path_info|escape }}{% endif %}</title>
   <style type="text/css">
     html * { padding:0; margin:0; }
     body * { padding:10px 20px; }
@@ -427,9 +424,10 @@
 </head>
 <body>
 <div id="summary">
-  <h1>{{ exception_type }}{% if request %} at {{ request.path_info|escape }}{% endif %}</h1>
-  <pre class="exception_value">{{ exception_value|force_escape }}</pre>
+  <h1>{% if exception_type %}{{ exception_type }}{% else %}Report{% endif %}{% if request %} at {{ request.path_info|escape }}{% endif %}</h1>
+  <pre class="exception_value">{% if exception_value %}{{ exception_value|force_escape }}{% else %}No exception supplied{% endif %}</pre>
   <table class="meta">
+{% if request %}
     <tr>
       <th>Request Method:</th>
       <td>{{ request.META.REQUEST_METHOD }}</td>
@@ -438,22 +436,29 @@
       <th>Request URL:</th>
       <td>{{ request.build_absolute_uri|escape }}</td>
     </tr>
+{% endif %}
     <tr>
       <th>Django Version:</th>
       <td>{{ django_version_info }}</td>
     </tr>
+{% if exception_type %}
     <tr>
       <th>Exception Type:</th>
       <td>{{ exception_type }}</td>
     </tr>
+{% endif %}
+{% if exception_value %}
     <tr>
       <th>Exception Value:</th>
       <td><pre>{{ exception_value|force_escape }}</pre></td>
     </tr>
+{% endif %}
+{% if lastframe %}
     <tr>
       <th>Exception Location:</th>
       <td>{{ lastframe.filename|escape }} in {{ lastframe.function|escape }}, line {{ lastframe.lineno }}</td>
     </tr>
+{% endif %}
     <tr>
       <th>Python Executable:</th>
       <td>{{ sys_executable|escape }}</td>
@@ -513,6 +518,7 @@
    </table>
 </div>
 {% endif %}
+{% if frames %}
 <div id="traceback">
   <h2>Traceback <span class="commands">{% if not is_email %}<a href="#" onclick="return switchPastebinFriendly(this);">Switch to copy-and-paste view</a></span>{% endif %}</h2>
   {% autoescape off %}
@@ -613,6 +619,7 @@
 </form>
 </div>
 {% endif %}
+{% endif %}
 
 <div id="requestinfo">
   <h2>Request information</h2>
@@ -723,6 +730,8 @@
       {% endfor %}
     </tbody>
   </table>
+{% else %}
+  <p>Request data not supplied</p>
 {% endif %}
 
   <h3 id="settings-info">Settings</h3>
Index: django/utils/log.py
===================================================================
--- django/utils/log.py	(revision 15359)
+++ django/utils/log.py	(working copy)
@@ -83,7 +83,7 @@
             exc_info = record.exc_info
             stack_trace = '\n'.join(traceback.format_exception(*record.exc_info))
         else:
-            exc_info = ()
+            exc_info = (None, None, None, )
             stack_trace = 'No stack trace available'
 
         message = "%s\n\n%s" % (stack_trace, request_repr)
