Opened 10 years ago

Last modified 5 years ago

#23714 closed Bug

Django-1.7 doesn't display 500 error pages during DST change — at Initial Version

Reported by: Markus Bertheau Owned by: nobody
Component: Template system Version: 1.7
Severity: Normal Keywords: timezone
Cc: tomas.ehrlich@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When an exception, that would normally - with DEBUG=True - be displayed in the detailed 500 page, occurs during the DST/no-DST ambiguous hour of the geographical area that is set as TIMEZONE, the handler crashes with AmbiguousTimeError. This seriously limits the ability of many developers to develop and Django applications for a time span of 1/8760 of the year. This is unacceptable!

2014-10-26 02:40:14,104    ERROR django.request                     :handle_uncaught_exception  231 Internal Server Error: /dashboard/suppliers/
Traceback (most recent call last):
  File "/home/markus/src/django/django/core/handlers/base.py", line 111, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/markus/src/django/django/db/transaction.py", line 394, in inner
    return func(*args, **kwargs)
  File "/home/markus/src/django/django/contrib/auth/decorators.py", line 22, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/markus/src/django/django/contrib/auth/decorators.py", line 22, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/markus/src/django/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/markus/src/django/django/views/generic/base.py", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/markus/src/django/django/views/generic/list.py", line 145, in get
    self.object_list = self.get_queryset()
  File "/home/markus/src/machtfit/apps/dashboard/supplier/views.py", line 44, in get_queryset
    .annotate(num_orders=Count('partner__order_line')))
  File "/home/markus/src/django/django/db/models/query.py", line 802, in annotate
    is_summary=False)
  File "/home/markus/src/django/django/db/models/sql/query.py", line 1012, in add_aggregate
    field_list, opts, self.get_initial_alias())
  File "/home/markus/src/django/django/db/models/sql/query.py", line 1419, in setup_joins
    names, opts, allow_many, fail_on_missing=True)
  File "/home/markus/src/django/django/db/models/sql/query.py", line 1383, in names_to_path
    self.raise_field_error(opts, name)
  File "/home/markus/src/django/django/db/models/sql/query.py", line 1389, in raise_field_error
    "Choices are: %s" % (name, ", ".join(available)))
FieldError: Cannot resolve keyword u'order_line' into field. Choices are: <irrelevant>
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/home/markus/src/django/django/contrib/staticfiles/handlers.py", line 64, in __call__
    return self.application(environ, start_response)
  File "/home/markus/src/django/django/core/handlers/wsgi.py", line 187, in __call__
    response = self.get_response(request)
  File "/home/markus/src/django/django/core/handlers/base.py", line 199, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/home/markus/src/django/django/core/handlers/base.py", line 236, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/home/markus/src/django/django/views/debug.py", line 91, in technical_500_response
    html = reporter.get_traceback_html()
  File "/home/markus/src/django/django/views/debug.py", line 350, in get_traceback_html
    return t.render(c)
  File "/home/markus/src/django/django/template/base.py", line 148, in render
    return self._render(context)
  File "/home/markus/src/django/django/test/utils.py", line 88, in instrumented_test_render
    return self.nodelist.render(context)
  File "/home/markus/src/django/django/template/base.py", line 844, in render
    bit = self.render_node(node, context)
  File "/home/markus/src/django/django/template/debug.py", line 80, in render_node
    return node.render(context)
  File "/home/markus/src/django/django/template/debug.py", line 90, in render
    output = self.filter_expression.resolve(context)
  File "/home/markus/src/django/django/template/base.py", line 624, in resolve
    new_obj = func(obj, *arg_vals)
  File "/home/markus/src/django/django/template/defaultfilters.py", line 769, in date
    return format(value, arg)
  File "/home/markus/src/django/django/utils/dateformat.py", line 343, in format
    return df.format(format_string)
  File "/home/markus/src/django/django/utils/dateformat.py", line 35, in format
    pieces.append(force_text(getattr(self, piece)()))
  File "/home/markus/src/django/django/utils/dateformat.py", line 268, in r
    return self.format('D, j M Y H:i:s O')
  File "/home/markus/src/django/django/utils/dateformat.py", line 35, in format
    pieces.append(force_text(getattr(self, piece)()))
  File "/home/markus/src/django/django/utils/dateformat.py", line 136, in O
    seconds = self.Z()
  File "/home/markus/src/django/django/utils/dateformat.py", line 189, in Z
    offset = self.timezone.utcoffset(self.data)
  File "/home/markus/.virtualenvs/machtfit/local/lib/python2.7/site-packages/pytz/tzinfo.py", line 406, in utcoffset
    dt = self.localize(dt, is_dst)
  File "/home/markus/.virtualenvs/machtfit/local/lib/python2.7/site-packages/pytz/tzinfo.py", line 349, in localize
    raise AmbiguousTimeError(dt)
AmbiguousTimeError: 2014-10-26 02:40:14.190834

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top