summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2015-02-10 21:37:53 +0100
committerTim Graham <timograham@gmail.com>2015-02-10 19:07:07 -0500
commitc6a49d4f17db4579389e3f0477436f2444dead10 (patch)
tree8d86896e803268f497aa00397fd24e9d372c36eb
parent6e23c9be46a3ab74c39daba5ce344b818ac30608 (diff)
[1.8.x] Fixed a crash of the debug page.
During the autumn DST change, the template engine would fail to convert the naive representation of now when USE_TZ = True. Passing now in UTC eliminates the issue. Thanks mbertheau and tricoder42. Refs #23714. Backport of c7a6996df7e77bc3b9c5e581e67d766627ebabec from master
-rw-r--r--django/views/debug.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/django/views/debug.py b/django/views/debug.py
index 0a4aa8f74d..80b0e38eb1 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
-import datetime
import os
import re
import sys
@@ -13,7 +12,7 @@ from django.http import (
)
from django.template import Context, Engine, TemplateDoesNotExist
from django.template.defaultfilters import force_escape, pprint
-from django.utils import lru_cache, six
+from django.utils import lru_cache, six, timezone
from django.utils.datastructures import MultiValueDict
from django.utils.encoding import force_bytes, smart_text
from django.utils.html import escape
@@ -362,7 +361,7 @@ class ExceptionReporter(object):
'settings': get_safe_settings(),
'sys_executable': sys.executable,
'sys_version_info': '%d.%d.%d' % sys.version_info[0:3],
- 'server_time': datetime.datetime.now(),
+ 'server_time': timezone.now(),
'django_version_info': get_version(),
'sys_path': sys.path,
'template_info': self.template_info,