Code

Ticket #6486: 0011-Add-server-time-to-error-page-info.patch

File 0011-Add-server-time-to-error-page-info.patch, 1.3 KB (added by Bastian Kleineidam <calvin@…>, 6 years ago)
  • django/views/debug.py

    From 6970bb9855d8bf3728995235923fee084d651b2c Mon Sep 17 00:00:00 2001
    From: Bastian Kleineidam <calvin@debian.org>
    Date: Fri, 25 Jan 2008 18:14:22 +0100
    Subject: Add server time to error page info
    
    Add the local server time to the HTTP 500 error page info.
    
    Signed-off-by: Bastian Kleineidam <calvin@debian.org>
    
    diff --git a/django/views/debug.py b/django/views/debug.py
    index e3be2a7..c31e9aa 100644
    a b  
    11import os 
    22import re 
    33import sys 
     4import datetime 
    45 
    56from django.conf import settings 
    67from django.template import Template, Context, TemplateDoesNotExist 
    def technical_500_response(request, exc_type, exc_value, tb): 
    147148        'settings': get_safe_settings(), 
    148149        'sys_executable': sys.executable, 
    149150        'sys_version_info': '%d.%d.%d' % sys.version_info[0:3], 
     151        'server_time': datetime.datetime.now(), 
    150152        'django_version_info': get_version(), 
    151153        'sys_path' : sys.path, 
    152154        'template_info': template_info, 
    TECHNICAL_500_TEMPLATE = """ 
    373375      <td>{{ sys_version_info }}</td> 
    374376    </tr> 
    375377    <tr> 
     378      <th>Server time:</th> 
     379      <td>{{server_time|date:"d.m.Y H:i:s"}}</td> 
     380    </tr> 
     381    <tr> 
    376382      <th>Python Path:</th> 
    377383      <td>{{ sys_path }}</td> 
    378384    </tr>