﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23070	Instances of callable classes with __slots__ attributes in settings causes a failure to draw the 500 template	colons	Hiroki Kiyohara	"In a fresh django project, adding the following snippet to your settings files prevents the 500 page from rendering:

{{{
class Class(object):
    __slots__ = ['attr']

    def __init__(self, attr):
        self.attr = attr

    def __call__(self):
        pass

INSTANCE = Class(1)
}}}

The error that prevents the 500 error page from rendering is:

{{{
Traceback (most recent call last):
  File ""/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py"", line 85, in run
    self.result = application(self.environ, self.start_response)
  File ""venv/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py"", line 64, in __call__
    return self.application(environ, start_response)
  File ""venv/lib/python2.7/site-packages/django/core/handlers/wsgi.py"", line 191, in __call__
    response = self.get_response(request)
  File ""venv/lib/python2.7/site-packages/django/core/handlers/base.py"", line 198, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File ""venv/lib/python2.7/site-packages/django/core/handlers/base.py"", line 241, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File ""venv/lib/python2.7/site-packages/django/views/debug.py"", line 79, in technical_500_response
    html = reporter.get_traceback_html()
  File ""venv/lib/python2.7/site-packages/django/views/debug.py"", line 337, in get_traceback_html
    c = Context(self.get_traceback_data(), use_l10n=False)
  File ""venv/lib/python2.7/site-packages/django/views/debug.py"", line 315, in get_traceback_data
    'settings': get_safe_settings(),
  File ""venv/lib/python2.7/site-packages/django/views/debug.py"", line 65, in get_safe_settings
    settings_dict[k] = cleanse_setting(k, getattr(settings, k))
  File ""venv/lib/python2.7/site-packages/django/views/debug.py"", line 55, in cleanse_setting
    cleansed.do_not_call_in_templates = True
AttributeError: 'Class' object has no attribute 'do_not_call_in_templates
}}}

For me, this is a problem because I'm upgrading a project that stores what time of the week certain things happen with instances of dateutil's weekday object in the settings. Reproduced in 1.7c1 and current master, never happened in 1.6. I can probably work around it, but it'll be upsettingly inelegant."	Bug	closed	Core (Other)	1.7-rc-1	Release blocker	fixed		Baptiste Mispelon hirokiky@…	Accepted	1	0	0	0	0	0
