Ticket #16507: 16507.4.diff

File 16507.4.diff, 1.3 KB (added by claudep, 4 years ago)

Prevent any custom handler500 or 500.html template

  • django/contrib/messages/tests/base.py

    diff --git a/django/contrib/messages/tests/base.py b/django/contrib/messages/tests/base.py
    index 8d04532..8c4df96 100644
    a b  
    11from django import http
    2 from django.conf import settings
     2from django.conf import settings, urls as urlhandlers
    33from django.contrib.messages import constants, utils, get_level, set_level
    44from django.contrib.messages.api import MessageFailure
    55from django.contrib.messages.storage import default_storage, base
    class BaseTest(TestCase): 
    5656
    5757    def setUp(self):
    5858        self.settings_override = override_settings_tags(
    59             TEMPLATE_DIRS  = (),
     59            TEMPLATE_LOADERS = (),
    6060            MESSAGE_TAGS    = '',
    6161            MESSAGE_STORAGE = '%s.%s' % (self.storage_class.__module__,
    6262                                         self.storage_class.__name__),
    6363        )
    6464        self.settings_override.enable()
     65        self.old_handler500 = urlhandlers.handler500
     66        urlhandlers.handler500 = 'django.views.defaults.server_error'
    6567
    6668    def tearDown(self):
    6769        self.settings_override.disable()
     70        urlhandlers.handler500 = self.old_handler500
    6871
    6972    def get_request(self):
    7073        return http.HttpRequest()
Back to Top